diff options
Diffstat (limited to 'lib/App/Beam/List.pm')
-rw-r--r-- | lib/App/Beam/List.pm | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/App/Beam/List.pm b/lib/App/Beam/List.pm index 3bba7e0..ac7031f 100644 --- a/lib/App/Beam/List.pm +++ b/lib/App/Beam/List.pm @@ -3,21 +3,47 @@ package App::Beam::List; use strict; use Carp; use POSIX qw(strftime); +use Unix::Sysexits; +use Getopt::Long qw(GetOptionsFromArray); -require App::Beam; +use App::Beam qw(:result); our @ISA = qw(App::Beam); +my %result_string = ( + RESULT_PENDING() => 'PENDING', + RESULT_SUCCESS() => 'SUCCESS', + RESULT_FAILURE() => 'FAILURE' +); + sub run { my $self = shift; - + my $verbose; + + shift; + GetOptionsFromArray(\@_, "verbose|v" => \$verbose); + $self->abend(EX_USAGE, "bad number of arguments") if @_; + $self->lock(); my @stat = @{$self->{status}}; shift @stat; foreach my $ent (@stat) { print strftime "%c ", localtime $ent->{timestamp}; printf("% 3d% 3d% 3d %s", $ent->{cycle}, $ent->{round}, $ent->{level}, - $ent->{result}); + $result_string{$ent->{result}}); print "\n"; + if ($verbose) { + my %detail; + @detail{keys %{$ent->{detail}}} = values %{$ent->{detail}}; + foreach my $item (split /\s+/, $self->get('core.items')) { + if (exists($detail{$item})) { + printf("# %-24s %s\n", $item, $result_string{$detail{$item}}); + delete $detail{$item}; + } + } + foreach my $item (sort keys %detail) { + printf("# %-24s %s\n", $item, $result_string{$detail{$item}}); + } + } } $self->unlock(); } |