ADD: allow commandline argument for issue description

This commit is contained in:
Dominik Meyer 2018-07-09 21:18:30 +02:00
parent 61d2e879e9
commit 4e9c713f19
No known key found for this signature in database
GPG Key ID: B4C312B600606B64

View File

@ -52,7 +52,14 @@ option 'type' => (
default => "bug" 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 sub run
@ -64,15 +71,24 @@ sub run
print("IssueManager not initialized yet. Please call \"init\" command to do so."); print("IssueManager not initialized yet. Please call \"init\" command to do so.");
exit(-1); exit(-1);
} }
my ($fh, $filename) = tempfile(); my ($fh, $filename) = tempfile();
close($fh); close($fh);
my $config=App::Git::IssueManager::Config->new(confname => 'config'); my $config=App::Git::IssueManager::Config->new(confname => 'config');
my $editor = $config->get(key=>"core.editor") || ENV{'EDITOR'} || "vim"; my $editor = $config->get(key=>"core.editor") || ENV{'EDITOR'} || "vim";
my $text;
if ($self->description eq "")
{
system($editor . " " .$filename); system($editor . " " .$filename);
$text = read_file($filename);
my $text = read_file($filename); }
else
{
$text = $self->description;
}
my $issue = Git::IssueManager::Issue->new(subject => $self->subject); my $issue = Git::IssueManager::Issue->new(subject => $self->subject);
$issue->description($text); $issue->description($text);