App-JobLog
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/JobLog/Command/note.pm view on Meta::CPAN
package App::JobLog::Command::note;
$App::JobLog::Command::note::VERSION = '1.042';
# ABSTRACT: take a note
use App::JobLog -command;
use Modern::Perl;
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);
use Class::Autouse qw(App::JobLog::Log);
sub execute {
my ( $self, $opt, $args ) = @_;
my $tags = $opt->tag;
my $log = App::JobLog::Log->new;
unless ( $tags || $opt->clear_tags ) {
my ($last) = $log->last_note;
$tags = $last->tags if $last;
}
$log->append_note(
$tags ? ( tags => $tags ) : (),
description => [ join ' ', @$args ],
);
}
sub usage_desc { '%c ' . __PACKAGE__->name . ' <text of note>' }
sub abstract { 'take a note' }
sub full_description {
<<END;
Take a note. E.g.,
@{[prog_name($0)]} @{[__PACKAGE__->name]} remember to get kids from school
All arguments that are not parameter values are concatenated as the note. Notes
have a time but not a duration. See the summary command for how to extract notes
from the log.
Notes may be tagged to assist in search or categorization.
END
}
sub options {
return (
[
'tag|t=s@',
'tag the note; multiple tags are acceptable; e.g., -t foo -t bar -t quux',
],
[
'clear-tags|T',
'inherit no tags from preceding note; '
. 'this is equivalent to -t ""; '
. 'this option has no effect if any tag is specified',
],
);
}
sub validate {
my ( $self, $opt, $args ) = @_;
$self->usage_error('no note provided') unless @$args;
}
1;
__END__
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.629 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )