mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-23 21:01:58 +00:00
Merge branch 'update/jira-plugin'
Closes #6506 Closes #6950 Closes #7962
This commit is contained in:
commit
480f1ecd96
2 changed files with 21 additions and 10 deletions
|
@ -23,6 +23,9 @@ jira reported [username] # queries for issues reported by a user
|
||||||
jira assigned [username] # queries for issues assigned to a user
|
jira assigned [username] # queries for issues assigned to a user
|
||||||
jira myissues # queries for you own issues
|
jira myissues # queries for you own issues
|
||||||
jira branch # opens an existing issue matching the current branch name
|
jira branch # opens an existing issue matching the current branch name
|
||||||
|
# The branch name may have prefixes ending in "/": "feature/MP-1234",
|
||||||
|
# and also suffixes starting with "_": "MP-1234_fix_dashboard"
|
||||||
|
# In both these cases, the issue opened will be "MP-1234"
|
||||||
jira ABC-123 # opens an existing issue
|
jira ABC-123 # opens an existing issue
|
||||||
jira ABC-123 m # opens an existing issue for adding a comment
|
jira ABC-123 m # opens an existing issue for adding a comment
|
||||||
```
|
```
|
||||||
|
|
|
@ -63,25 +63,33 @@ function jira() {
|
||||||
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
|
||||||
# but `branch` is a special case that will parse the current git branch
|
# but `branch` is a special case that will parse the current git branch
|
||||||
|
local issue_arg issue
|
||||||
if [[ "$action" == "branch" ]]; then
|
if [[ "$action" == "branch" ]]; then
|
||||||
local issue_arg=$(git rev-parse --abbrev-ref HEAD)
|
# Get name of the branch
|
||||||
local issue="${jira_prefix}${issue_arg}"
|
issue_arg=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
# Strip prefixes like feature/ or bugfix/
|
||||||
|
issue_arg=${issue_arg##*/}
|
||||||
|
# Strip suffixes starting with _
|
||||||
|
issue_arg=(${(s:_:)issue_arg})
|
||||||
|
issue_arg=${issue_arg[1]}
|
||||||
|
if [[ "$issue_arg" = ${jira_prefix}* ]]; then
|
||||||
|
issue="${issue_arg}"
|
||||||
|
else
|
||||||
|
issue="${jira_prefix}${issue_arg}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
local issue_arg=$action
|
issue_arg=${(U)action}
|
||||||
local issue="${jira_prefix}${issue_arg}"
|
issue="${jira_prefix}${issue_arg}"
|
||||||
fi
|
fi
|
||||||
local url_fragment=''
|
|
||||||
|
local url_fragment
|
||||||
if [[ "$2" == "m" ]]; then
|
if [[ "$2" == "m" ]]; then
|
||||||
url_fragment="#add-comment"
|
url_fragment="#add-comment"
|
||||||
echo "Add comment to issue #$issue"
|
echo "Add comment to issue #$issue"
|
||||||
else
|
else
|
||||||
echo "Opening issue #$issue"
|
echo "Opening issue #$issue"
|
||||||
fi
|
fi
|
||||||
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
|
open_command "${jira_url}/browse/${issue}${url_fragment}"
|
||||||
open_command "${jira_url}/issues/${issue}${url_fragment}"
|
|
||||||
else
|
|
||||||
open_command "${jira_url}/browse/${issue}${url_fragment}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue