Skip to content

Commit

Permalink
tt log -t foo -t bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Henning Thorsen committed Aug 30, 2015
1 parent 3e8d776 commit 1f50e8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/tt
Expand Up @@ -119,6 +119,7 @@ sub action_log {
my $self = shift;
my $seconds = 0;
my $n_events = 0;
my $tags = join ',', @{$self->tag};
my @project_re = map {qr{^$_\b}} split /,/, $self->project || '.+';
my ($interval, $offset, $pl, $path, $when, $fill) = ('', 0, 0);
my @log;
Expand All @@ -143,7 +144,9 @@ sub action_log {
wanted => sub {
my ($date, $hms, $project) = /^(\d+)-(\d+)_(.*)\.trc$/ or return;
my $event = decode_json(_slurp($_));
$event->{tags} ||= [];
return if @project_re and !grep { $event->{project} =~ $_ } @project_re;
return if $tags and !grep { $tags =~ /\b$_\b/ } @{$event->{tags}};
return unless $event->{seconds};
$event->{start} = $self->_from_iso_8601($event->{start});
push @log, $self->_fill_log_days(@log ? $log[-1]->{start} : $when, $event->{start}) if $fill;
Expand All @@ -163,7 +166,7 @@ sub action_log {
$start->month, $start->mday, $start->hour, $start->minute,
$self->_hms_duration($event->{seconds}, 'hm'),
$event->{project} || '---',
join(',', @{$event->{tags} || []}),
join(',', @{$event->{tags}}),
color('reset')
);
}
Expand Down

0 comments on commit 1f50e8c

Please sign in to comment.