From 4e9c713f192e5c5a3733294d8c4073a9f9c242fb Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Mon, 9 Jul 2018 21:18:30 +0200 Subject: [PATCH] ADD: allow commandline argument for issue description --- lib/App/Git/IssueManager/Add.pm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/App/Git/IssueManager/Add.pm b/lib/App/Git/IssueManager/Add.pm index c9a04dc..509319c 100644 --- a/lib/App/Git/IssueManager/Add.pm +++ b/lib/App/Git/IssueManager/Add.pm @@ -52,7 +52,14 @@ option 'type' => ( default => "bug" ); - +option 'description' => ( + is => 'ro', + isa => 'Str', + required => 0, + documentation => q[the description of the issue, only plain text or markdown. If not given an editor is started.], + cmd_aliases => [qw(d)], + default => "" +); sub run @@ -64,15 +71,24 @@ sub run print("IssueManager not initialized yet. Please call \"init\" command to do so."); exit(-1); } + + my ($fh, $filename) = tempfile(); close($fh); my $config=App::Git::IssueManager::Config->new(confname => 'config'); my $editor = $config->get(key=>"core.editor") || ENV{'EDITOR'} || "vim"; - system($editor . " " .$filename); - - my $text = read_file($filename); + my $text; + if ($self->description eq "") + { + system($editor . " " .$filename); + $text = read_file($filename); + } + else + { + $text = $self->description; + } my $issue = Git::IssueManager::Issue->new(subject => $self->subject); $issue->description($text);