diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-05-08 20:48:44 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-05-08 20:48:44 -0500 |
commit | a470747864e9774c512e611ecc39e389c242af80 (patch) | |
tree | 30063b26061f48358d747977a77e308f07192655 /lib/App/Hiveminder/Command/create.pm | |
download | app-hiveminder-a470747864e9774c512e611ecc39e389c242af80.tar.gz app-hiveminder-a470747864e9774c512e611ecc39e389c242af80.zip |
initial framework, the create command works
Diffstat (limited to 'lib/App/Hiveminder/Command/create.pm')
-rw-r--r-- | lib/App/Hiveminder/Command/create.pm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/App/Hiveminder/Command/create.pm b/lib/App/Hiveminder/Command/create.pm new file mode 100644 index 0000000..ebdae82 --- /dev/null +++ b/lib/App/Hiveminder/Command/create.pm @@ -0,0 +1,31 @@ +#!/usr/bin/perl +package App::Hiveminder::Command::create; +use Moose; +use App::Hiveminder::Utils qw/get_text_from_editor_or_cmdline display_tasks + update_tasks/; +extends 'App::Hiveminder::Base'; + +sub run { + my ($self, $opt, $args) = @_; + print "Running create...\n"; + print "$_\n" for @$args; + $args = join " ", @$args; + + + my $text = get_text_from_editor_or_cmdline($args); + return '' if $text eq ''; + my @text = split "\n", $text; + + my $task = $self->hm->create_task(shift @text); + my $ret = display_tasks($self->hm, $task); + + if (@text > 0) { + $ret = display_tasks($self->hm, + @{ update_tasks($self->hm, [$self->hm->id2loc($task->{id})], + sub { (description => (join "\n", @text)) }) }); + } + + print $ret, "\n"; +} + +1; |