summaryrefslogtreecommitdiffstats
path: root/lib/App/Hiveminder/Command/Comment.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Hiveminder/Command/Comment.pm')
-rw-r--r--lib/App/Hiveminder/Command/Comment.pm29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/App/Hiveminder/Command/Comment.pm b/lib/App/Hiveminder/Command/Comment.pm
new file mode 100644
index 0000000..63973f9
--- /dev/null
+++ b/lib/App/Hiveminder/Command/Comment.pm
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+package App::Hiveminder::Command::Comment;
+use Moose;
+use App::Hiveminder::Utils qw/get_text_from_editor_or_cmdline display_tasks/;
+extends 'App::Hiveminder::Command';
+
+=head2 NAME
+
+App::Hiveminder::Command::Comment - Add a comment to a task
+
+=cut
+
+sub command_names { qw/comment add-comment add_comment comment-on comment_on/ }
+
+sub command {
+ my $self = shift;
+
+ return unless @_ > 0;
+ my $locator = shift;
+ $self->hm->comment_on($self->hm->read_task($locator),
+ get_text_from_editor_or_cmdline(@_));
+ my $task = $self->hm->read_task($locator);
+ my $display = display_tasks($self->hm, $task);
+ return "Comments for: $display\n" .
+ (join "\n", $self->hm->comments_on($task));
+}
+
+__PACKAGE__->meta()->make_immutable();
+1;