13 ['--help|?', "Show this help message.",
15 ['--head|h', "Shows only the head of the QA test",
17 ['--body|b', "Shows only the body of the QA test.",
19 ['--one-line|1', "Output everything on a single line.",
24 GetOptions(map { @{$_}[0] => @{$_}[2] } @oa);
30 my @qatests = map {sprintf("%03d", $_)} @ARGV;
31 @qatests = get_qa_tests() unless (@qatests);
34 my @h = get_qa_header($_);
38 } elsif ($opt{'body'}) {
43 if ($opt{'oneline'}) {
44 print map {s/\n/ /; $_} @h;
50 print "--------------------------------------------------\n" unless (@qatests < 2);
56 # local $_ = @{$_}[0];
57 @{$_}[0] =~ s/=(.*)$//;
58 @{$_}[0] =~ s/\|/ \| -/;
60 @{$_}[0] =~ s/$/ \] /;
64 print "Usage: $0\t$sa\n";
67 print "\t$$_[0]\t$$_[1]\n";
71 sub get_qa_header($) {
72 my $f = shift || die "need an argument";
75 open(my $FH, $f) || die "couldn't open '$f': $!";
78 m/^#\!/ and next; #shebang
79 m/^#\s*\-{10}/ and last; #dashed lines
80 m/^#\s*copyright/i and last; #copyright lines
91 my $d = shift || $ENV{'PWD'};
93 opendir(my $DIR, $d) || die "can't opendir $d: $!";
94 my @qa = grep {m/^\d\d\d$/ && -f "$d/$_" } readdir($DIR);