ADD: added status command

This commit is contained in:
Dominik Meyer 2018-09-15 21:25:19 +02:00
parent 69797d983e
commit f8512006c8
No known key found for this signature in database
GPG Key ID: B4C312B600606B64

View File

@ -0,0 +1,46 @@
package App::Git::IssueManager::Status;
#ABSTRACT: class implementing the status 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 Text::ANSITable;
use Term::ANSIColor;
use Try::Tiny;
use Data::Dumper;
command_short_description 'get the status of issues repository';
command_usage 'git issue status';
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);
}
binmode(STDOUT, ":utf8");
my $stats=$manager->stats();
my $tag = $manager->tag();
my $t = Text::ANSITable->new;
$t->use_utf8(1);
$t->use_color(1);
$t->use_box_chars(1);
$t->border_style('Default::single_boxchar');
$t->columns(["Name","Value"]);
$t->add_row(["Open Issues",$stats->{open}]);
$t->add_row(["Assigned Issues",$stats->{assigned}]);
$t->add_row(["Inprogress Issues",$stats->{inprogess}]);
$t->add_row(["Closed Issues",$stats->{closed}]);
print $t->draw;
}
1;