X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=bin%2Fjira;h=c84f38ffcf4258c7c20988b6b4ec8c662f2016a7;hb=b116c94968d6b617afc02a7d0ffb940757054b6a;hp=96135c6c2769cb79dd778ddc439d726b0709755f;hpb=95a467f08d52c0a4c78cb9fdb73705a15f0b745f;p=clearscm.git diff --git a/bin/jira b/bin/jira index 96135c6..c84f38f 100755 --- a/bin/jira +++ b/bin/jira @@ -24,7 +24,7 @@ Andrew DeFaria =item Revision: -$Revision: 1.0 $ +$Revision: 1.1 $ =item Created: @@ -32,7 +32,7 @@ Monday, April 25 2022 =item Modified: -Monday, April 25 2022 +Friday, October 21, 2022 =back @@ -58,7 +58,7 @@ Monday, April 25 2022 This script looks up a JIRA case and displays its summary. It can also display the reporter and assignee. More fields can be added later on. -Note: Case ID (e.g. ART-1928) can be just a number and if so "ART-" will be +Note: Case ID (e.g. CPANEL-1928) can be just a number and if so "CPANEL-" will be prepended. Credentials should be put in ~/.jira and the file properly secured @@ -67,7 +67,10 @@ Credentials should be put in ~/.jira and the file properly secured password: server: -If server is not specified jira.cpanel.net will be assumed +If server is not specified jira.cpanel.net will be assumed. + +Note: If you don't specify a case ID then an attempt will be made to determine + the case ID from the branch name. =cut @@ -83,6 +86,7 @@ use lib "$FindBin::Bin/../lib"; use JIRA (); use GetConfig (); +use Utils (); my $conf = "$ENV{HOME}/.jira"; @@ -132,6 +136,18 @@ GetOptions( 'server=s', ) || pod2usage; +unless ( $ARGV[0] ) { + + # Try to get case number from branch + my ( $status, @output ) = Utils::Execute("git branch --show-current 2>&1"); + + unless ($status) { + if ($output[0] =~ /(\w+-)*(\d+)/) { + $ARGV[0] = $2; + } + } +} + pod2usage("ERROR: A case ID required\n") unless $ARGV[0]; $opts{server} //= 'jira.cpanel.net'; @@ -142,7 +158,7 @@ my @cases = @ARGV; for my $caseID (@cases) { if ( $caseID =~ /^(\d+)$/ ) { - $caseID = "ART-$1"; + $caseID = "CPANEL-$1"; } my $case;