2018-07-04 10:45:42 +02:00
|
|
|
package App::Git::IssueManager::Init;
|
|
|
|
#ABSTRACT: class implementing the init 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-04 10:45:42 +02:00
|
|
|
use Git::IssueManager;
|
|
|
|
use Git::IssueManager::Issue;
|
|
|
|
|
|
|
|
use Term::ANSIColor;
|
|
|
|
use Try::Tiny;
|
|
|
|
|
|
|
|
|
|
|
|
command_short_description 'initialize IssueManager in the current git repository';
|
|
|
|
command_usage 'git issue init -t TST';
|
|
|
|
|
|
|
|
option 'tag' => (
|
|
|
|
is => 'ro',
|
|
|
|
isa => 'Str',
|
|
|
|
required => 1,
|
|
|
|
documentation => q[the tag to prepend in front of issue ids (eg. TST-ab5436fe, TST is the tag)],
|
|
|
|
cmd_aliases => [qw(t)]
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
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-04 10:45:42 +02:00
|
|
|
if (!$manager->ready)
|
|
|
|
{
|
|
|
|
$manager->init($self->tag);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
die("IssueManager already initialized");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|