From d6f54d5c7f5b3a06aad9eeddbfd2b6585035d485 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Fri, 9 May 2008 02:37:30 -0500 Subject: add a rename command --- lib/App/Hiveminder/Command/Rename.pm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/App/Hiveminder/Command/Rename.pm diff --git a/lib/App/Hiveminder/Command/Rename.pm b/lib/App/Hiveminder/Command/Rename.pm new file mode 100644 index 0000000..7d2ad30 --- /dev/null +++ b/lib/App/Hiveminder/Command/Rename.pm @@ -0,0 +1,25 @@ +#!/usr/bin/perl +package App::Hiveminder::Command::Rename; +use Moose; +use App::Hiveminder::Utils qw/get_text_from_editor_or_cmdline display_tasks/; +extends 'App::Hiveminder::Command'; + +=head2 NAME + +App::Hiveminder::Command::Rename - Change the summary of a task + +=cut + +sub command_names { qw/rename ren mv/ } + +sub command { + my $self = shift; + my $locator = shift; + my $task = $self->hm->read_task($locator); + return "Invalid locator $locator" unless defined $task; + my $text = get_text_from_editor_or_cmdline(@_); + return display_tasks($self->hm, + $self->hm->update_task($locator, summary => $text)); +} + +1; -- cgit v1.2.3