Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Add a --year option to scopes.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Nov 7, 2016
1 parent a516eb4 commit 6f2320d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions charting/scopes.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
# Parse command line arguments
use Getopt::Long;
my $allMonths;
GetOptions('all' => \$allMonths);
my $oneYear;
GetOptions('all' => \$allMonths, 'year' => \$oneYear);

# By default, only show results for the most recent month
if (!$allMonths) {
if ($allMonths) {
# leave table intact
} elsif ($oneYear) {
# reduce months table to just the last 12 entries
@months = @months[-12..-1];
} else {
# reduce months table to one element
my $oneMonth = pop @months;
@months = ( $oneMonth );
@months = @months[-1..-1];
}

# ingest files
Expand All @@ -31,7 +36,9 @@
my $scope = $_;
$scopes{$scope} = 1;
}
push @count, scalar(keys(%scopes));
my $prefix = scalar(@months) == 1 ? '' : "$month: ";
my $c = scalar(keys(%scopes));
push @count, "$prefix$c";
close TXT;
}

Expand All @@ -40,4 +47,4 @@
print "$n\n";
}

1;
1;

0 comments on commit 6f2320d

Please sign in to comment.