1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-09-24 17:00:47 +00:00

Better support for branch name

Enable to get issue from branch prefixed with it and delimited by '_'
This commit is contained in:
RoToRx88 2018-06-26 15:19:22 +02:00 committed by Marc Cornellà
parent 2f6d79b75d
commit 952200044d

View file

@ -65,7 +65,12 @@ function jira() {
# but `branch` is a special case that will parse the current git branch
if [[ "$action" == "branch" ]]; then
local issue_arg=$(git rev-parse --abbrev-ref HEAD)
local issue="${jira_prefix}${issue_arg}"
issue_arg=($(echo $issue_arg | cut -d'_' -f1))
if [[ $(echo ${issue_arg} | grep ${jira_prefix}) ]]; then
local issue="${issue_arg}"
else
local issue="${jira_prefix}${issue_arg}"
fi
else
local issue_arg=${(U)action}
local issue="${jira_prefix}${issue_arg}"