From 8003594e21442823bd00520bb88abdbc7f1af785 Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Wed, 4 Jul 2018 16:17:31 +0200 Subject: [PATCH] ADD: added delete command --- lib/App/Git/IssueManager/Del.pm | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/App/Git/IssueManager/Del.pm diff --git a/lib/App/Git/IssueManager/Del.pm b/lib/App/Git/IssueManager/Del.pm new file mode 100644 index 0000000..392ae6e --- /dev/null +++ b/lib/App/Git/IssueManager/Del.pm @@ -0,0 +1,38 @@ +package App::Git::IssueManager::Del; +#ABSTRACT: class implementing the del issue command of the GIT IssueManager +use strict; +use warnings; +use MooseX::App::Command; +extends qw(App::Git::IssueManager); +use Git::RepositoryHL; +use Git::IssueManager; +use Git::IssueManager::Issue; + +use Term::ANSIColor; +use Try::Tiny; + + +command_short_description 'delete an issue from a repository identified by the given id'; +command_usage 'git issue del -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; + my $manager = Git::IssueManager->new(repository=>Git::RepositoryHL->new(git_dir=> ".")); + if (!$manager->ready) + { + print("IssueManager not initialized yet. Please call \"init\" command to do so."); + exit(-1); + } + + my $issue=$manager->delete($self->id); +} +1;