implementing --incoming, --incumbent shortcuts
authorShawn Boyette <sboyette@esilibrary.com>
Tue, 26 Aug 2008 20:13:29 +0000 (20:13 +0000)
committerShawn Boyette <sboyette@esilibrary.com>
Tue, 26 Aug 2008 20:13:29 +0000 (20:13 +0000)
fingerprinter

index 06af0ff..46759b9 100755 (executable)
@@ -286,6 +286,8 @@ sub initialize {
     binmode(STDIN, ':utf8');
 
     my $rc = GetOptions( $c,
+                         'incoming',
+                         'incumbent',
                          'exception|x=s',
                          'output|o=s',
                          'runtype|r=s',
@@ -295,6 +297,20 @@ sub initialize {
                          'help|h',
                        );
     show_help() unless $rc;
+    show_help() if ($c->{help});
+
+    # set defaults if told to do so
+    if ($c->{incoming}) {
+        $c->{tag} = 903;
+        $c->{subfield} = 'a';
+        $c->{output} = 'incoming.fp';
+        $c->{exception} = 'incoming.ex';
+    } elsif ($c->{incumbent}) {
+        $c->{tag} = 901;
+        $c->{subfield} = 'c';
+        $c->{output} = 'incumbent.fp';
+        $c->{exception} = 'incumbent.ex';
+    }
 
     my @keys = keys %{$c};
     show_help() unless (@ARGV and @keys);
@@ -304,8 +320,6 @@ sub initialize {
         print "Required option: ", join(', ', @missing), " missing!\n";
         show_help();
     }
-
-    show_help() if ($c->{help});
 }
 
 
@@ -327,7 +341,7 @@ Display usage message when things go wrong
 
 sub show_help {
 print <<HELP;
-Usage is: fingerprinter [REQUIRED ARGS] [OPTIONS] <filelist>
+Usage is: $0 [REQUIRED ARGS] [OPTIONS] <filelist>
 Req'd Arguments
   --runtype=(primary|full) -r  Do 'primary' or 'full' fingerprinting
   --tag=N                  -t  Which tag to use
@@ -335,7 +349,13 @@ Req'd Arguments
   --output=<file>          -o  Output filename
   --exceptions=<file>      -x  Exception report filename
 Options
-  --quiet  -q  Don't write status messages to STDOUT
+  --incoming     Set -r to 'full'; -t, -s, -o, -x to incoming defaults
+  --incumbent    Set -r to 'full'; -t, -s, -o, -x to incumbent defaults
+
+                 Example: '$0 --incoming' is equivalent to
+                          '$0 -r full -t 903 -s a -o incoming.fp -x incoming.ex'
+
+  --quiet    -q  Don't write status messages to STDOUT
 HELP
 exit 1;
 }