summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (mars.fritz.box) <paul@buetow.org>2014-03-18 09:30:33 +0100
committerPaul Buetow (mars.fritz.box) <paul@buetow.org>2014-03-18 09:30:33 +0100
commite637ec68dc7e09dd8c6aae0c13803c0257c6d68c (patch)
treeeb298efa8bb7b9bc3142ad0e0c897a9f62b831a5
parentb5cae8e54976d57f802f955b9bf475c09ae52c74 (diff)
add unassigned switch0.4.0
-rw-r--r--docs/japi.pod5
-rwxr-xr-xsrc/japi24
2 files changed, 20 insertions, 9 deletions
diff --git a/docs/japi.pod b/docs/japi.pod
index fba1775..8a080af 100644
--- a/docs/japi.pod
+++ b/docs/japi.pod
@@ -16,6 +16,7 @@ Synopsis: japi
[--version]
[--nocolor]
[--passfile]
+ [--unassigned]
[--jira_apiversion STRING]
[--jira_query STRING]
[--jira_uribase STRING]
@@ -47,6 +48,10 @@ Specifies the path to an optional file which includes the Jira API password but
If the file is not present, Japi will prompt for the password.
+=item --unassigned
+
+By default the output lists assigned and unassigned issues. Use this switch to only list unassigned issues.
+
=item --jira_apiversion STRING
Specifies the Jira API version to use. The default value is C<rest/api/2>.
diff --git a/src/japi b/src/japi
index c44fcfa..a163403 100755
--- a/src/japi
+++ b/src/japi
@@ -29,12 +29,13 @@ package Japi::Japi {
# Also set some default values.
my %opts = (
# General options
- version => { type => '', value => 0 },
- nocolor => { type => '', value => 0 },
- #verbose => { type => '', value => 0 },
- debug => { type => '', value => 0 },
- help => { type => '', value => 0 },
- passfile => { type => '=s', value => "$ENV{HOME}/.japipass" },
+ version => { type => '', value => 0 },
+ nocolor => { type => '', value => 0 },
+ #verbose => { type => '', value => 0 },
+ debug => { type => '', value => 0 },
+ help => { type => '', value => 0 },
+ passfile => { type => '=s', value => "$ENV{HOME}/.japipass" },
+ unassigned => { type => '', value => 0 },
# Jira specific options
jira_uribase => { type => '=s', value => 'https://your-jira.example.com' },
@@ -135,7 +136,8 @@ package Japi::Jira {
has apiversion => ( is => 'ro' );
has uribase => ( is => 'ro' );
has issues => ( is => 'rw' );
- has nocolor => ( is => 'ro' );
+ has nocolor => ( is => 'ro' );
+ has unassigned => ( is => 'ro' );
sub run_query {
my $self = shift;
@@ -179,11 +181,14 @@ package Japi::Jira {
$a->{fields}{created} cmp $b->{fields}{created};
} grep {
- not defined $_->{fields}{assignee};
+ if ($self->unassigned) {
+ not defined $_->{fields}{assignee};
+ } else {
+ 1;
+ }
} @{$self->issues};
- say '';
print color 'bold green' unless $self->nocolor;
say "==> Listed $counter issues";
print color 'reset' unless $self->nocolor;
@@ -210,6 +215,7 @@ my $jira = Japi::Jira->new(
uribase => $japi->opt('jira_uribase'),
apiversion => $japi->opt('jira_apiversion'),
nocolor => $japi->opt('nocolor'),
+ unassigned => $japi->opt('unassigned'),
);
$jira->run_query();