From: Andrew DeFaria Date: Wed, 25 Jan 2023 19:51:28 +0000 (-0800) Subject: Merge branch 'master' of git+ssh://github.com/adefaria/clearscm X-Git-Url: https://defaria.com/gitweb/?a=commitdiff_plain;h=d3c598399f93a1ca4ffc9f4aedd7907f4157ca43;hp=0ce6b60d0dffe894fcefc01605e8c113b47362a2;p=clearscm.git Merge branch 'master' of git+ssh://github.com/adefaria/clearscm --- diff --git a/bin/jira b/bin/jira index 96135c6..ed2f582 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) { + $output[0] =~ /\w+-(\d+)/; + + $ARGV[0] = $1; + } +} + 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;