2018-09-16 23:07:37 +02:00
|
|
|
package App::Git::IssueManager::Modify;
|
|
|
|
#ABSTRACT: class implementing the modify issue command of the GIT IssueManager
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use MooseX::App::Command;
|
|
|
|
extends qw(App::Git::IssueManager);
|
|
|
|
use Git::LowLevel;
|
|
|
|
use Git::IssueManager;
|
|
|
|
use Git::IssueManager::Issue;
|
|
|
|
use App::Git::IssueManager::Config;
|
|
|
|
use File::Temp qw/ tempfile/;
|
|
|
|
use File::Slurp;
|
|
|
|
use Term::ANSIColor;
|
|
|
|
use Try::Tiny;
|
|
|
|
|
|
|
|
|
2019-03-24 00:35:54 +01:00
|
|
|
command_short_description 'modify an issue within a project';
|
2018-09-16 23:07:37 +02:00
|
|
|
command_usage 'git issue add -s Humbug';
|
|
|
|
|
|
|
|
option 'subject' => (
|
|
|
|
is => 'ro',
|
|
|
|
isa => 'Str',
|
|
|
|
required => 0,
|
|
|
|
documentation => q[the subject/title of the issue],
|
|
|
|
cmd_aliases => [qw(s)]
|
|
|
|
);
|
|
|
|
|
|
|
|
option 'priority' => (
|
|
|
|
is => 'ro',
|
|
|
|
isa => 'Str',
|
|
|
|
required => 0,
|
|
|
|
documentation => q[the priority of the issue (low, medium, high, urgent)],
|
|
|
|
cmd_aliases => [qw(p)],
|
|
|
|
default => ""
|
|
|
|
);
|
|
|
|
|
|
|
|
option 'severity' => (
|
|
|
|
is => 'ro',
|
|
|
|
isa => 'Str',
|
|
|
|
required => 0,
|
|
|
|
documentation => q[the severity of the issue (low, medium, high, critical)],
|
|
|
|
cmd_aliases => [qw(e)],
|
|
|
|
default => ""
|
|
|
|
);
|
|
|
|
|
|
|
|
option 'type' => (
|
|
|
|
is => 'ro',
|
|
|
|
isa => 'Str',
|
|
|
|
required => 0,
|
|
|
|
documentation => q[the type of the issue (bug, security-bug, improvement, feature, task)],
|
|
|
|
cmd_aliases => [qw(t)],
|
|
|
|
default => ""
|
|
|
|
);
|
|
|
|
|
|
|
|
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 => ""
|
|
|
|
);
|
|
|
|
|
|
|
|
option 'id' => (
|
|
|
|
is => 'ro',
|
|
|
|
isa => 'Str',
|
|
|
|
required => 1,
|
|
|
|
documentation => q[the id of the issue],
|
|
|
|
cmd_aliases => [qw(i)]
|
|
|
|
);
|
|
|
|
|
|
|
|
sub run
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
my $manager = Git::IssueManager->new(repository=>Git::LowLevel->new(git_dir=> "."));
|
|
|
|
if (!$manager->ready)
|
|
|
|
{
|
|
|
|
print("IssueManager not initialized yet. Please call \"init\" command to do so.");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $modifications={};
|
|
|
|
|
|
|
|
if ($self->type)
|
|
|
|
{
|
|
|
|
$modifications->{type}=$self->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($self->subject)
|
|
|
|
{
|
|
|
|
$modifications->{subject}=$self->subject;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($self->priority)
|
|
|
|
{
|
|
|
|
$modifications->{priority}=$self->priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($self->severity)
|
|
|
|
{
|
|
|
|
$modifications->{severity}=$self->severity;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($self->description)
|
|
|
|
{
|
|
|
|
$modifications->{description}=$self->description;
|
|
|
|
}
|
|
|
|
|
|
|
|
$manager->modify($self->id,$modifications);
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|