chiark / gitweb /
xlog: Optionally show more approval/rejection reasons
[modbot-ulm.git] / xlog / bin / record
index 2e9bc7003ebfcb810df69bfc3f6700bdb2f3381f..916be1282e640c8755d4f9bb6b03fddecbb2e28a 100755 (executable)
@@ -8,12 +8,20 @@ our %f;
 
 my $publish_rejections_patfile= '/dev/null';
 my $publish_rejections= 0;
-if ($ARGV[0] eq '-P') {
-    $publish_rejections= 1;
-    shift @ARGV;
-} elsif ($ARGV[0] =~ s/^\-P//) {
-    $publish_rejections= 1;
-    $publish_rejections_patfile= shift @ARGV;
+
+for (;;) {
+    last unless @ARGV;
+    last unless $ARGV[0] =~ m/^-/;
+    $_ = shift @ARGV;
+    last if m/^--?$/;
+    while (m/^-./) {
+       if (s/^-P(.*)$//) {
+           $publish_rejections= 1;
+           $publish_rejections_patfile= $1 if length $1;
+       } else {
+           die "bad option $_ ?";
+       }
+    }
 }
 
 our ($how) = @_;
@@ -88,10 +96,14 @@ sub parse_webstump2stump () {
        parse__stumpsubject();
        last if m/^$/;
     }
+    my $cathow = '';
     while (<STDIN>) {
        chomp;
+       if (m/^\#( \w+.*)$/) {
+           $cathow = $1;
+       }
        next unless m/^reject|^approve|^preapprove/;
-       $f{Event}= $_;
+       $f{Event}= $_.$cathow;
        last;
     }
 }