More command line options.
This commit is contained in:
		
							parent
							
								
									aa5e41555e
								
							
						
					
					
						commit
						7685bfc61a
					
				
					 1 changed files with 13 additions and 3 deletions
				
			
		|  | @ -11,9 +11,11 @@ use Getopt::Long; | |||
| use File::Spec; | ||||
| use Date::Manip qw(ParseDate UnixDate); | ||||
| 
 | ||||
| my($PAYMENT_DIR, $VERBOSE, $INTERACTIVE, $PAYMENT_NUMBER, $RT_CMD); | ||||
| 
 | ||||
| sub FindUniqueTicket(@) { | ||||
|   my @searchTerms = @_; | ||||
|   open(my $rtLsFH, "-|", "rt", "ls", "-i", 'Queue = outreachy-interns AND ' . | ||||
|   open(my $rtLsFH, "-|", "$RT_CMD", "ls", "-i", 'Queue = outreachy-interns AND ' . | ||||
|        join(" AND ", @searchTerms)); | ||||
|   my $ticketSpec; | ||||
|   while (my $lsLine = <$rtLsFH>) { | ||||
|  | @ -29,14 +31,22 @@ sub FindUniqueTicket(@) { | |||
|   close $rtLsFH; | ||||
|   return $ticketSpec; | ||||
| } | ||||
| my($PAYMENT_DIR, $VERBOSE); | ||||
| 
 | ||||
| GetOptions("paymentDir=s", \$PAYMENT_DIR, "verbose=i", \$VERBOSE); | ||||
| GetOptions("paymentDir=s" => \$PAYMENT_DIR, "verbose=i" => \$VERBOSE, "interactive" => \$INTERACTIVE, | ||||
|            "paymentNumber=i" => \$PAYMENT_NUMBER, "rtCommand=s" => $RT_CMD); | ||||
| 
 | ||||
| $RT_CMD = '/usr/bin/rt' unless defined $RT_CMD; | ||||
| 
 | ||||
| $INTERACTIVE = 0 if not defined $INTERACTIVE; | ||||
| 
 | ||||
| unless (defined $PAYMENT_DIR and -d $PAYMENT_DIR) { | ||||
|   print STDERR "usage: $0 --paymentDir=<DIRECTORY>   option is required and directory must exist\n"; | ||||
|   exit 1; | ||||
| } | ||||
| unless (defined $PAYMENT_NUMBER and $PAYMENT_NUMBER =~ /^123$/) { | ||||
|   print STDERR "usage: $0 --paymentNumber=<VALUE>  option is required and must be 1, 2 or 3\n"; | ||||
|   exit 1; | ||||
| } | ||||
| $VERBOSE = 0 unless defined $VERBOSE; | ||||
| 
 | ||||
| opendir(my $dh, $PAYMENT_DIR); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn