mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 13:50:09 +00:00
Add shortcut for opening current branch in Jira (#6366)
This commit is contained in:
parent
e8e7bf3b89
commit
529a12fac8
2 changed files with 9 additions and 2 deletions
|
@ -7,6 +7,7 @@ _1st_arguments=(
|
||||||
'dashboard:open the dashboard'
|
'dashboard:open the dashboard'
|
||||||
'reported:search for issues reported by a user'
|
'reported:search for issues reported by a user'
|
||||||
'assigned:search for issues assigned to 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'
|
'dumpconfig:display effective jira configuration'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,14 @@ function jira() {
|
||||||
echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
|
echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
|
||||||
else
|
else
|
||||||
# Anything that doesn't match a special action is considered an issue name
|
# Anything that doesn't match a special action is considered an issue name
|
||||||
local issue_arg=$action
|
# but `branch` is a special case that will parse the current git branch
|
||||||
local issue="${jira_prefix}${issue_arg}"
|
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=''
|
local url_fragment=''
|
||||||
if [[ "$2" == "m" ]]; then
|
if [[ "$2" == "m" ]]; then
|
||||||
url_fragment="#add-comment"
|
url_fragment="#add-comment"
|
||||||
|
|
Loading…
Reference in a new issue