summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-05-09 03:43:16 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-05-09 03:43:16 -0500
commit74d577e7015aea1b4ceb1f83aab54c29d1924b0b (patch)
tree2ec448856e1b72fc983e949e64c6dbf0565a4f26
parent4580c47ac709d8296a25d868bb9fd091cc390c04 (diff)
downloadapp-hiveminder-74d577e7015aea1b4ceb1f83aab54c29d1924b0b.tar.gz
app-hiveminder-74d577e7015aea1b4ceb1f83aab54c29d1924b0b.zip
add decline
-rw-r--r--lib/App/Hiveminder/Command/Decline.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/App/Hiveminder/Command/Decline.pm b/lib/App/Hiveminder/Command/Decline.pm
new file mode 100644
index 0000000..da34aac
--- /dev/null
+++ b/lib/App/Hiveminder/Command/Decline.pm
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+package App::Hiveminder::Command::Decline;
+use Moose;
+use App::Hiveminder::Utils qw/parse_args display_tasks/;
+extends 'App::Hiveminder::Command';
+
+=head2 NAME
+
+App::Hiveminder::Command::Decline - Decline offered tasks
+
+=cut
+
+sub command_names { qw/decline/ }
+
+sub command {
+ my $self = shift;
+
+ return unless @_ > 0;
+ my $ret = '';
+ for my $task ($hm->get_tasks(%{ parse_args @_ })) {
+ my $updated_task = $hm->update_task($task, accepted => 0);
+ # we get a task hash with each field undef if it succeeds
+ if (!defined $updated_task->{id}) {
+ $ret .= "Declined " . display_tasks($task) . "\n";
+ }
+ }
+
+ return $ret;
+}
+
+__PACKAGE__->meta()->make_immutable();
+1;