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
1 changed files with 20 additions and 4 deletions

View File

@ -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);