App-JobLog
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/JobLog/Command/summary.pm view on Meta::CPAN
package App::JobLog::Command::summary;
$App::JobLog::Command::summary::VERSION = '1.042';
# ABSTRACT: show what you did during a particular period
use App::JobLog -command;
use Modern::Perl;
use Class::Autouse qw(
App::JobLog::Log
App::JobLog::Log::Day
);
use autouse 'App::JobLog::TimeGrammar' => qw(parse daytime);
use autouse 'Carp' => qw(carp);
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);
use autouse 'App::JobLog::Config' => qw(
columns
is_hidden
merge
);
use autouse 'App::JobLog::Log::Format' => qw(
display
single_interval
summary
);
use autouse 'App::JobLog::Log::Synopsis' => qw(
MERGE_ALL
MERGE_ADJACENT
MERGE_ADJACENT_SAME_TAGS
MERGE_SAME_TAGS
MERGE_SAME_DAY
MERGE_SAME_DAY_SAME_TAGS
MERGE_NONE
);
use autouse 'App::JobLog::Time' => qw(today);
no if $] >= 5.018, warnings => "experimental::smartmatch";
sub execute {
my ( $self, $opt, $args ) = @_;
my $tags = $opt->{tag} || [];
my $excluded_tags = $opt->{exclude_tag} || [];
my $match = $opt->{match} || [];
my $no_match = $opt->{no_match} || [];
my $time_expr = join( ' ', @$args ) || $opt->{date};
my $time = $opt->{time};
$time_expr ||= $opt->{date};
# validate regexes, if any, while generating test
# NOTE: using $opt->{x} form rather than $opt->x to facilitate invoking summary
# from today command
my $test = _make_test( $tags, $excluded_tags, $match, $no_match, $time );
my $merge_level;
for ( $opt->{merge} || '' ) {
when ('no_merge') {
$merge_level = MERGE_NONE
}
when ('merge_all') {
$merge_level = MERGE_ALL
}
when ('merge_adjacent') {
$merge_level = MERGE_ADJACENT
}
when ('merge_adjacent_same_tags') {
$merge_level = MERGE_ADJACENT_SAME_TAGS
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.598 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )