3636
3737my %options = ();
3838
39- getopts(" dsASlDH:" , \%options );
39+ use Getopt::Long qw( GetOptions Configure) ;
40+ Configure(qw( no_ignore_case) );
4041
41- our $optionPrintDebug = 1 if defined $options {d };
42- our $optionDisableAspell = 1 if defined $options {A };
43- our $optionUseXmlSimple = 1 if defined $options {s };
44- our $optionDisableStyleCheck = 1 if defined $options {S };
45- our $optionShowLogCaller = 1 if defined $options {l };
46- our $optionDumpHistoryFile = 1 if defined $options {D };
47- our $optionHistoryFile = $options {H } if defined $options {H };
42+ my ($optionPrintDebug , $optionDisableAspell , $optionUseXmlSimple ,
43+ $optionDisableStyleCheck , $optionShowLogCaller , $optionDumpHistoryFile ,
44+ $optionHistoryFile , $mydir );
45+
46+ my @mycommits ;
47+
48+ GetOptions(
49+ ' d|debug' => \$optionPrintDebug ,
50+ ' A|no-aspell' => \$optionDisableAspell ,
51+ ' s|xmlsimple' => \$optionUseXmlSimple ,
52+ ' S|no-style' => \$optionDisableStyleCheck ,
53+ ' l|show-caller' => \$optionShowLogCaller ,
54+ ' D|dump-history' => \$optionDumpHistoryFile ,
55+ ' H|history-file=s' => \$optionHistoryFile ,
56+
57+ ' dir=s' => \$mydir , # Directory to process, e.g. inc or meta (default: inc)
58+ ' commits=s{,}' => \@mycommits , # --commits c1 c2 c3 ...
59+ ) or die " Usage: $0 [opts] --dir <dir> --commits <c1> [c2 ...]\n " ;
4860
4961$SIG {__DIE__ } = sub
5062{
@@ -127,13 +139,15 @@ sub ProcessHeaders
127139{
128140 my $commit = shift ;
129141
130- my @headers = GetHeaderFiles(" temp/commit-$commit /inc" );
142+ my $dir = defined ($mydir ) ? $mydir : ' inc' ;
143+ my $path = " temp/commit-$commit /$dir " ;
144+
145+ my @headers = GetHeaderFiles($path );
131146
132147 for my $header (@headers )
133148 {
134- LogDebug " Processing $header " ;
135-
136- ProcessSingleHeader " temp/commit-$commit /inc/$header " ;
149+ LogDebug " Processing $path /$header " ;
150+ ProcessSingleHeader " $path /$header " ;
137151 }
138152}
139153
@@ -245,7 +259,7 @@ sub CleanData
245259 LogInfo " loaded history from $optionHistoryFile " ;
246260}
247261
248- for my $commit (@ARGV )
262+ for my $commit (@mycommits )
249263{
250264 # reset
251265
@@ -264,15 +278,15 @@ sub CleanData
264278
265279ExitOnErrorsOrWarnings();
266280
267- if (defined $optionDumpHistoryFile and (scalar @ARGV > 0))
281+ if (defined $optionDumpHistoryFile and (scalar @mycommits > 0))
268282{
269283 $Data::Dumper::Indent = 0;
270284
271285 my $history = Data::Dumper-> Dump([\%HISTORY ],[qw/ *HISTORY/ ]);
272286
273287 $history =~ s / // g ;
274288
275- my $lastCommit = $ARGV [-1];
289+ my $lastCommit = $mycommits [-1];
276290
277291 WriteFile(" ancestry.$lastCommit .history" , $history );
278292
0 commit comments