From ebb535fa0b28e79b1ad55cff88b337b052554392 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Fri, 9 May 2008 02:49:32 -0500 Subject: add an untag command --- lib/App/Hiveminder/Command/Untag.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/App/Hiveminder/Command/Untag.pm (limited to 'lib') diff --git a/lib/App/Hiveminder/Command/Untag.pm b/lib/App/Hiveminder/Command/Untag.pm new file mode 100644 index 0000000..4219895 --- /dev/null +++ b/lib/App/Hiveminder/Command/Untag.pm @@ -0,0 +1,27 @@ +#!/usr/bin/perl +package App::Hiveminder::Command::Untag; +use Moose; +use App::Hiveminder::Utils qw/update_tasks parse_args display_tasks/; +extends 'App::Hiveminder::Command'; + +=head2 NAME + +App::Hiveminder::Command::Untag - Remove a tag from tasks + +=cut + +sub command_names { qw/untag/ } + +sub command { + my $self = shift; + + return unless @_ > 1; + my $tag = pop; + return display_tasks($self->hm, + @{ update_tasks($self->hm, parse_args(@_), + sub { my $tags = shift->{tags}; + $tags =~ s/\Q\"$tag\"//; + (tags => $tags) }) }); +} + +1; -- cgit v1.2.3-54-g00ecf