From 529a12fac857efbfa749998ed872d668ff51d15d Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Wed, 1 Nov 2017 21:04:41 +0800 Subject: Add shortcut for opening current branch in Jira (#6366) --- plugins/jira/_jira | 1 + plugins/jira/jira.plugin.zsh | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins/jira') diff --git a/plugins/jira/_jira b/plugins/jira/_jira index 03fe6a499..890f97f4c 100644 --- a/plugins/jira/_jira +++ b/plugins/jira/_jira @@ -7,6 +7,7 @@ _1st_arguments=( 'dashboard:open the dashboard' 'reported:search for issues reported by a user' 'assigned:search for issues assigned to a user' + 'br:open the issue named after the git branch of the current directory' 'dumpconfig:display effective jira configuration' ) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 67c989457..fe1772cd8 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -51,8 +51,14 @@ function jira() { echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION" else # Anything that doesn't match a special action is considered an issue name - local issue_arg=$action - local issue="${jira_prefix}${issue_arg}" + # but `branch` is a special case that will parse the current git branch + if [[ "$action" == "br" ]]; then + local issue_arg=$(git rev-parse --abbrev-ref HEAD) + local issue="${jira_prefix}${issue_arg}" + else + local issue_arg=$action + local issue="${jira_prefix}${issue_arg}" + fi local url_fragment='' if [[ "$2" == "m" ]]; then url_fragment="#add-comment" -- cgit v1.2.3-70-g09d2 From 6d5b1f1e3be483bb09315d22a2175d1c97998167 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Wed, 1 Nov 2017 21:09:10 +0800 Subject: Allow jira default action file based setting (#6367) --- plugins/jira/jira.plugin.zsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'plugins/jira') diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index fe1772cd8..7d4e5b921 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -2,13 +2,19 @@ # # See README.md for details -: ${JIRA_DEFAULT_ACTION:=new} - function jira() { emulate -L zsh - local action=${1:=$JIRA_DEFAULT_ACTION} + local action jira_url jira_prefix + if [[ -f .jira-default-action ]]; then + action=$(cat .jira-default-action) + elif [[ -f ~/.jira-default-action ]]; then + action=$(cat ~/.jira-default-action) + elif [[ -n "${JIRA_DEFAULT_ACTION}" ]]; then + action=${JIRA_DEFAULT_ACTION} + else + action="new" + fi - local jira_url jira_prefix if [[ -f .jira-url ]]; then jira_url=$(cat .jira-url) elif [[ -f ~/.jira-url ]]; then -- cgit v1.2.3-70-g09d2 From 93120c4151b0bbc831ce29f5386f8d9dcf313573 Mon Sep 17 00:00:00 2001 From: ramanduh Date: Sat, 4 Nov 2017 18:31:42 +0100 Subject: jira plugin: take into account action argument (fix #6388) (#6393) --- plugins/jira/jira.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins/jira') diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 7d4e5b921..0340dd7f4 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -5,7 +5,9 @@ function jira() { emulate -L zsh local action jira_url jira_prefix - if [[ -f .jira-default-action ]]; then + if [[ -n "$1" ]]; then + action=$1 + elif [[ -f .jira-default-action ]]; then action=$(cat .jira-default-action) elif [[ -f ~/.jira-default-action ]]; then action=$(cat ~/.jira-default-action) -- cgit v1.2.3-70-g09d2 From 5f2c34374babf5749f2701a10cd81800b41fc908 Mon Sep 17 00:00:00 2001 From: Eric Hudon Date: Sun, 18 Mar 2018 17:10:34 -0400 Subject: Change the br action to branch to be more explicit. (#6678) --- plugins/jira/README.md | 1 + plugins/jira/jira.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins/jira') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index efb8a743a..a934ae68c 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -21,6 +21,7 @@ jira new # opens a new issue jira dashboard # opens your JIRA dashboard jira reported [username] # queries for issues reported by a user jira assigned [username] # queries for issues assigned to a user +jira branch # opens an existing issue matching the current branch name jira ABC-123 # opens an existing issue jira ABC-123 m # opens an existing issue for adding a comment ``` diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 0340dd7f4..052481a60 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -60,7 +60,7 @@ function jira() { else # Anything that doesn't match a special action is considered an issue name # but `branch` is a special case that will parse the current git branch - if [[ "$action" == "br" ]]; then + if [[ "$action" == "branch" ]]; then local issue_arg=$(git rev-parse --abbrev-ref HEAD) local issue="${jira_prefix}${issue_arg}" else -- cgit v1.2.3-70-g09d2 From 132bffcbe164bc3b60208215ddea5bd405605f2b Mon Sep 17 00:00:00 2001 From: Zopanix Date: Mon, 26 Mar 2018 21:04:27 -0400 Subject: Added a myissues option This will allow the user to directly open the my open issues page. This will make it easier for the user to open his open issues in jira. --- plugins/jira/jira.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins/jira') diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 052481a60..e03bda90e 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -44,6 +44,9 @@ function jira() { open_command "${jira_url}/secure/CreateIssue!default.jspa" elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then _jira_query $@ + elif [[ "$action" == "myissues" ]]; then + echo "Opening my issues" + open_command "${jira_url}/issues/?filter=-1" elif [[ "$action" == "dashboard" ]]; then echo "Opening dashboard" if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then -- cgit v1.2.3-70-g09d2 From afb028763cf40fc339e49011b2cba124dc108fcb Mon Sep 17 00:00:00 2001 From: Zopanix Date: Tue, 27 Mar 2018 09:16:43 -0400 Subject: MOdified README to reflect changes for myissues command --- plugins/jira/README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/jira') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index a934ae68c..091dccb97 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -21,6 +21,7 @@ jira new # opens a new issue jira dashboard # opens your JIRA dashboard jira reported [username] # queries for issues reported by a user jira assigned [username] # queries for issues assigned to a user +jira myissues # queries for you own issues jira branch # opens an existing issue matching the current branch name jira ABC-123 # opens an existing issue jira ABC-123 m # opens an existing issue for adding a comment -- cgit v1.2.3-70-g09d2 From 2aa2ea744eff2322b1fc2a31be556d95dda83797 Mon Sep 17 00:00:00 2001 From: Eric Hudon Date: Sun, 15 Apr 2018 07:17:23 -0400 Subject: Change the br argument to branch to follow PR #6678. (#6680) --- plugins/jira/_jira | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/jira') diff --git a/plugins/jira/_jira b/plugins/jira/_jira index 890f97f4c..d64614233 100644 --- a/plugins/jira/_jira +++ b/plugins/jira/_jira @@ -7,7 +7,7 @@ _1st_arguments=( 'dashboard:open the dashboard' 'reported:search for issues reported by a user' 'assigned:search for issues assigned to a user' - 'br:open the issue named after the git branch of the current directory' + 'branch:open the issue named after the git branch of the current directory' 'dumpconfig:display effective jira configuration' ) -- cgit v1.2.3-70-g09d2 From 81ed25610dd6a7de858c38fa5bfb1545ebfc46e0 Mon Sep 17 00:00:00 2001 From: Wayne Porter Date: Tue, 7 May 2019 09:11:28 -0700 Subject: jira: fix error when assigned or reported are default (#7731) Signed-off-by: Wayne Porter --- plugins/jira/jira.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/jira') diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 052481a60..fcf8b2959 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -43,7 +43,7 @@ function jira() { echo "Opening new issue" open_command "${jira_url}/secure/CreateIssue!default.jspa" elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then - _jira_query $@ + _jira_query ${@:-$action} elif [[ "$action" == "dashboard" ]]; then echo "Opening dashboard" if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then -- cgit v1.2.3-70-g09d2