ADD: command to assign a worker to an issue
This commit is contained in:
parent
7b271603a5
commit
59433c506b
47
lib/App/Git/IssueManager/Assign.pm
Normal file
47
lib/App/Git/IssueManager/Assign.pm
Normal file
@ -0,0 +1,47 @@
|
||||
package App::Git::IssueManager::Assign;
|
||||
#ABSTRACT: class implementing the assign 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 Term::ANSIColor;
|
||||
use Try::Tiny;
|
||||
|
||||
|
||||
command_short_description 'assign an issue from a repository identified by the given id to a user';
|
||||
command_usage 'git issue assign -i TST-a34df432 -w "Dominik Meyer <dmeyer@federationhq.de>"';
|
||||
|
||||
option 'id' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
documentation => q[the id of the issue],
|
||||
cmd_aliases => [qw(i)]
|
||||
);
|
||||
|
||||
option 'worker' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
documentation => q[the user to assign the issue to],
|
||||
cmd_aliases => [qw(w)]
|
||||
);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
$self->worker() =~ /^(.*)<(.*)>$/;
|
||||
my $issue=$manager->assign($self->id, $1, $2);
|
||||
}
|
||||
1;
|
Loading…
Reference in New Issue
Block a user