-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangeset.pl
More file actions
42 lines (39 loc) · 865 Bytes
/
changeset.pl
File metadata and controls
42 lines (39 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl
# Adapter script for Changeset.pm module
# exports Changeset.pm functionality for command line use.
use strict;
use warnings;
use Changeset;
use OsmApi;
#OsmApi::setup;
if ($ARGV[0] eq "create")
{
my $cs = Changeset::create($ARGV[1]);
print "changeset created: $cs\n" if defined($cs);
}
elsif (($ARGV[0] eq "close") && (scalar(@ARGV)==3))
{
if (Changeset::close($ARGV[1], $ARGV[2]))
{
print "changeset closed.\n";
}
}
elsif (($ARGV[0] eq "upload") && (scalar(@ARGV)==2))
{
my $body = "";
while(<STDIN>) { $body .= $_; }
if (length($body) == 0)
{
print "usage: $0 upload <id> < content-to-upload\n";
exit;
}
if (Changeset::upload($ARGV[1], $body))
{
print "changeset uploaded.\n";
}
}
else
{
print "usage: $0 {create [<comment>] | close <id> <comment>}\n";
exit;
}