-
Notifications
You must be signed in to change notification settings - Fork 13
/
batch_redaction.pl
43 lines (40 loc) · 1.19 KB
/
batch_redaction.pl
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
43
#!/usr/bin/perl
use strict;
use FindBin;
use lib "$FindBin::Bin/lib";
use BatchRedaction;
if (($ARGV[0] eq "view") && (scalar(@ARGV) == 2))
{
BatchRedaction::view($ARGV[1]);
}
elsif (($ARGV[0] eq "view.json") && (scalar(@ARGV) == 2))
{
BatchRedaction::view($ARGV[1], ".json");
}
elsif (($ARGV[0] eq "apply") && (scalar(@ARGV) == 3))
{
BatchRedaction::apply($ARGV[1], $ARGV[2], 0);
}
elsif (($ARGV[0] eq "apply-skip") && (scalar(@ARGV) == 3))
{
BatchRedaction::apply($ARGV[1], $ARGV[2], 1);
}
elsif (($ARGV[0] eq "unapply") && (scalar(@ARGV) == 2))
{
BatchRedaction::apply($ARGV[1], 0, 0);
}
else
{
print <<EOF;
Usage:
$0 view <filename> view in xml format osm elements listed in the file
$0 view.json <filename> view in json format osm elements listed in the file
$0 apply <filename> <rid> redact elements listed in the file, stop immediately on error
$0 apply-skip <filename> <rid> redact elements listed in the file, skip an element on error
$0 unapply <filename> unredact elements listed in the file
where
filename : name of file listing element versions; each line is <otype>/<oid>/<oversion>
rid : redaction id
EOF
exit;
}