2018-07-09 21:18:41 +02:00
|
|
|
package App::Git::IssueManager::Close;
|
|
|
|
#ABSTRACT: class implementing the close issue command of the GIT IssueManager
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use MooseX::App::Command;
|
|
|
|
extends qw(App::Git::IssueManager);
|
2018-09-10 22:43:42 +02:00
|
|
|
use Git::LowLevel;
|
2018-07-09 21:18:41 +02:00
|
|
|
use Git::IssueManager;
|
|
|
|
use Git::IssueManager::Issue;
|
|
|
|
|
|
|
|
use Term::ANSIColor;
|
|
|
|
use Try::Tiny;
|
|
|
|
|
|
|
|
|
|
|
|
command_short_description 'close an issue from a repository identified by the given id';
|
|
|
|
command_usage 'git issue close -i TST-a34df432';
|
|
|
|
|
|
|
|
option 'id' => (
|
|
|
|
is => 'ro',
|
|
|
|
isa => 'Str',
|
|
|
|
required => 1,
|
|
|
|
documentation => q[the id of the issue],
|
|
|
|
cmd_aliases => [qw(i)]
|
|
|
|
);
|
|
|
|
|
|
|
|
sub run
|
|
|
|
{
|
|
|
|
my $self = shift;
|
2018-09-10 22:43:42 +02:00
|
|
|
my $manager = Git::IssueManager->new(repository=>Git::LowLevel->new(git_dir=> "."));
|
2018-07-09 21:18:41 +02:00
|
|
|
if (!$manager->ready)
|
|
|
|
{
|
|
|
|
print("IssueManager not initialized yet. Please call \"init\" command to do so.");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $issue=$manager->close($self->id);
|
|
|
|
}
|
|
|
|
1;
|