summaryrefslogtreecommitdiffstats
path: root/lib/App/Hiveminder/Command/Tag.pm
blob: 23e5eca636e5d8a7a711257ba87676e22b205879 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl
package App::Hiveminder::Command::Tag;
use Moose;
use App::Hiveminder::Utils qw/update_tasks parse_args display_tasks/;
extends 'App::Hiveminder::Command';

=head2 NAME

App::Hiveminder::Command::Tag - Add a tag to tasks

=cut

sub command_names { qw/tag/ }

sub command {
    my $self = shift;

    return unless @_ > 1;
    my $tag = pop;
    return display_tasks($self->hm,
        @{ update_tasks($self->hm, parse_args(@_),
                        sub { (tags => shift->{tags} . " \"$tag\"") }) });
}

1;