line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::JobLog::Command::tags; |
2
|
|
|
|
|
|
|
$App::JobLog::Command::tags::VERSION = '1.041'; |
3
|
|
|
|
|
|
|
# ABSTRACT: show what tags you have used |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1973
|
use App::JobLog -command; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
15
|
|
6
|
2
|
|
|
2
|
|
771
|
use Modern::Perl; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
7
|
2
|
|
|
2
|
|
227
|
use Class::Autouse qw(App::JobLog::Log); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
20
|
|
8
|
2
|
|
|
2
|
|
95
|
use autouse 'App::JobLog::TimeGrammar' => qw(parse); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
9
|
2
|
|
|
2
|
|
121
|
use autouse 'Getopt::Long::Descriptive' => qw(prog_name); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub execute { |
12
|
9
|
|
|
9
|
1
|
100
|
my ( $self, $opt, $args ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
9
|
|
|
|
|
19
|
my $events = []; |
15
|
9
|
|
|
|
|
19
|
eval { |
16
|
9
|
100
|
|
|
|
25
|
if (@$args) |
17
|
|
|
|
|
|
|
{ |
18
|
6
|
|
|
|
|
37
|
my ( $start, $end ) = parse( join( ' ', @$args ) ); |
19
|
6
|
100
|
|
|
|
28
|
$events = App::JobLog::Log->new->find_events( $start, $end ) |
20
|
|
|
|
|
|
|
unless $opt->notes; |
21
|
|
|
|
|
|
|
push @$events, |
22
|
6
|
100
|
100
|
|
|
380
|
@{ App::JobLog::Log->new->find_notes( $start, $end ) } |
|
4
|
|
|
|
|
174
|
|
23
|
|
|
|
|
|
|
unless !( $opt->notes || $opt->all ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
3
|
|
|
|
|
6
|
my $method = 'all_events'; |
27
|
3
|
100
|
|
|
|
8
|
if ( $opt->notes ) { |
|
|
100
|
|
|
|
|
|
28
|
1
|
|
|
|
|
6
|
$method = 'all_notes'; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ( $opt->all ) { |
31
|
1
|
|
|
|
|
10
|
$method = 'all_taglines'; |
32
|
|
|
|
|
|
|
} |
33
|
3
|
|
|
|
|
30
|
$events = App::JobLog::Log->new->$method; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
}; |
36
|
9
|
50
|
|
|
|
194
|
$self->usage_error($@) if $@; |
37
|
9
|
|
|
|
|
543
|
my %tags; |
38
|
9
|
|
|
|
|
25
|
for my $e (@$events) { |
39
|
8
|
|
|
|
|
15
|
$tags{$_} = 1 for @{ $e->tags }; |
|
8
|
|
|
|
|
35
|
|
40
|
|
|
|
|
|
|
} |
41
|
9
|
100
|
|
|
|
31
|
if (%tags) { |
42
|
7
|
|
|
|
|
37
|
print "\n"; |
43
|
7
|
|
|
|
|
161
|
say $_ for sort keys %tags; |
44
|
7
|
|
|
|
|
130
|
print "\n"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
2
|
|
|
|
|
13
|
say 'no tags in log'; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
9
|
|
|
9
|
1
|
15805
|
sub usage_desc { '%c ' . __PACKAGE__->name . ' %o [date or date range]' } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub abstract { |
54
|
0
|
|
|
0
|
1
|
0
|
'list tags employed in log or some subrange thereof'; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub full_description { |
58
|
|
|
|
|
|
|
<
|
59
|
|
|
|
|
|
|
List the tags used to categorize tasks or notes in the log or in a specified range of dates. This allows one to |
60
|
|
|
|
|
|
|
explore the categorical structure of tasks and notes. By default only tags associated with notes are listed. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The date expressions understood are the same as those understood by the C command. |
63
|
|
|
|
|
|
|
END |
64
|
0
|
|
|
0
|
0
|
0
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub options { |
67
|
|
|
|
|
|
|
return ( |
68
|
|
|
|
|
|
|
[ |
69
|
9
|
|
|
9
|
0
|
19
|
"Use '@{[prog_name]} help " |
|
9
|
|
|
|
|
33
|
|
70
|
|
|
|
|
|
|
. __PACKAGE__->name |
71
|
|
|
|
|
|
|
. '\' to see full details.' |
72
|
|
|
|
|
|
|
], |
73
|
|
|
|
|
|
|
[ 'notes|n', 'only list tags used on notes' ], |
74
|
|
|
|
|
|
|
[ 'all|a', 'list tags for both notes and tasks' ], |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub validate { |
79
|
9
|
|
|
9
|
0
|
16
|
my ( $self, $opt, $args ) = @_; |
80
|
9
|
50
|
66
|
|
|
36
|
$self->usage_error('--notes conflicts will --all') |
81
|
|
|
|
|
|
|
if $opt->notes && $opt->all; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |