| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::JobLog::Command::note; | 
| 2 |  |  |  |  |  |  | $App::JobLog::Command::note::VERSION = '1.039'; | 
| 3 |  |  |  |  |  |  | # ABSTRACT: take a note | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 2 |  |  | 2 |  | 1605 | use App::JobLog -command; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 15 |  | 
| 6 | 2 |  |  | 2 |  | 743 | use Modern::Perl; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 13 |  | 
| 7 | 2 |  |  | 2 |  | 221 | use autouse 'Getopt::Long::Descriptive' => qw(prog_name); | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 13 |  | 
| 8 | 2 |  |  | 2 |  | 111 | use Class::Autouse qw(App::JobLog::Log); | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 17 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub execute { | 
| 11 | 1 |  |  | 1 | 1 | 6 | my ( $self, $opt, $args ) = @_; | 
| 12 | 1 |  |  |  |  | 3 | my $tags = $opt->tag; | 
| 13 | 1 |  |  |  |  | 12 | my $log  = App::JobLog::Log->new; | 
| 14 | 1 | 50 | 33 |  |  | 8 | unless ( $tags || $opt->clear_tags ) { | 
| 15 | 1 |  |  |  |  | 12 | my ($last) = $log->last_note; | 
| 16 | 1 | 50 |  |  |  | 5 | $tags = $last->tags if $last; | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  | $log->append_note( | 
| 19 | 1 | 50 |  |  |  | 14 | $tags ? ( tags => $tags ) : (), | 
| 20 |  |  |  |  |  |  | description => [ join ' ', @$args ], | 
| 21 |  |  |  |  |  |  | ); | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 1 |  |  | 1 | 1 | 1778 | sub usage_desc { '%c ' . __PACKAGE__->name . ' ' } | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 0 |  |  | 0 | 1 | 0 | sub abstract { 'take a note' } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub full_description { | 
| 29 | 0 |  |  | 0 | 0 | 0 | < | 
| 30 |  |  |  |  |  |  | Take a note. E.g., | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 0 |  |  |  |  | 0 | @{[prog_name($0)]} @{[__PACKAGE__->name]} remember to get kids from school | 
|  | 0 |  |  |  |  | 0 |  | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | All arguments that are not parameter values are concatenated as the note. Notes | 
| 35 |  |  |  |  |  |  | have a time but not a duration. See the summary command for how to extract notes | 
| 36 |  |  |  |  |  |  | from the log. | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | Notes may be tagged to assist in search or categorization. | 
| 39 |  |  |  |  |  |  | END | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | sub options { | 
| 43 |  |  |  |  |  |  | return ( | 
| 44 |  |  |  |  |  |  | [ | 
| 45 | 1 |  |  | 1 | 0 | 15 | 'tag|t=s@', | 
| 46 |  |  |  |  |  |  | 'tag the note; multiple tags are acceptable; e.g., -t foo -t bar -t quux', | 
| 47 |  |  |  |  |  |  | ], | 
| 48 |  |  |  |  |  |  | [ | 
| 49 |  |  |  |  |  |  | 'clear-tags|T', | 
| 50 |  |  |  |  |  |  | 'inherit no tags from preceding note; ' | 
| 51 |  |  |  |  |  |  | . 'this is equivalent to -t ""; ' | 
| 52 |  |  |  |  |  |  | . 'this option has no effect if any tag is specified', | 
| 53 |  |  |  |  |  |  | ], | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | ); | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | sub validate { | 
| 59 | 1 |  |  | 1 | 0 | 3 | my ( $self, $opt, $args ) = @_; | 
| 60 |  |  |  |  |  |  |  | 
| 61 | 1 | 50 |  |  |  | 6 | $self->usage_error('no note provided') unless @$args; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | 1; | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | __END__ |