App-JobLog
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/JobLog/Command/tags.pm view on Meta::CPAN
package App::JobLog::Command::tags;
$App::JobLog::Command::tags::VERSION = '1.042';
# ABSTRACT: show what tags you have used
use App::JobLog -command;
use Modern::Perl;
use Class::Autouse qw(App::JobLog::Log);
use autouse 'App::JobLog::TimeGrammar' => qw(parse);
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);
sub execute {
my ( $self, $opt, $args ) = @_;
my $events = [];
eval {
if (@$args)
{
my ( $start, $end ) = parse( join( ' ', @$args ) );
$events = App::JobLog::Log->new->find_events( $start, $end )
unless $opt->notes;
push @$events,
@{ App::JobLog::Log->new->find_notes( $start, $end ) }
unless !( $opt->notes || $opt->all );
}
else {
my $method = 'all_events';
if ( $opt->notes ) {
$method = 'all_notes';
}
elsif ( $opt->all ) {
$method = 'all_taglines';
}
$events = App::JobLog::Log->new->$method;
}
};
$self->usage_error($@) if $@;
my %tags;
for my $e (@$events) {
$tags{$_} = 1 for @{ $e->tags };
}
if (%tags) {
print "\n";
say $_ for sort keys %tags;
print "\n";
}
else {
say 'no tags in log';
}
}
sub usage_desc { '%c ' . __PACKAGE__->name . ' %o [date or date range]' }
sub abstract {
'list tags employed in log or some subrange thereof';
}
sub full_description {
<<END
List the tags used to categorize tasks or notes in the log or in a specified range of dates. This allows one to
explore the categorical structure of tasks and notes. By default only tags associated with notes are listed.
The date expressions understood are the same as those understood by the C<summary> command.
END
}
sub options {
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.610 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )