summaryrefslogtreecommitdiff
path: root/plugins/jira/README.md
diff options
context:
space:
mode:
authorKen van der Eerden <15888558+Ken-vdE@users.noreply.github.com>2025-01-23 21:08:55 +0100
committerGitHub <noreply@github.com>2025-01-23 21:08:55 +0100
commit5fd2059e5eda17ee07501a21d47189d4b96d6ff3 (patch)
tree43f8a75ffcaa29876e83fe2fd2ed30ec324804a6 /plugins/jira/README.md
parent85c49414926ad86f76d7bad3635f948bb5f883cb (diff)
downloadzsh-5fd2059e5eda17ee07501a21d47189d4b96d6ff3.tar.gz
zsh-5fd2059e5eda17ee07501a21d47189d4b96d6ff3.tar.bz2
zsh-5fd2059e5eda17ee07501a21d47189d4b96d6ff3.zip
feat(jira): allow branch name customization (#12850)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins/jira/README.md')
-rw-r--r--plugins/jira/README.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/jira/README.md b/plugins/jira/README.md
index 7cfb81b19..19266e7f0 100644
--- a/plugins/jira/README.md
+++ b/plugins/jira/README.md
@@ -43,6 +43,22 @@ starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opene
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
"mp-1234" opens the issue "mp-1234", and "1234" opens the issue "MP-1234".
+If your branch naming convention deviates, you can overwrite the jira_branch function to determine and echo the Jira issue key yourself.
+Define a function `jira_branch` after sourcing `oh-my-zsh.sh` in your `.zshrc`.
+Example:
+```zsh
+# Determine branch name from naming convention 'type/KEY-123/description'.
+function jira_branch() {
+ # Get name of the branch
+ issue_arg=$(git rev-parse --abbrev-ref HEAD)
+ # Strip prefixes like feature/ or bugfix/
+ issue_arg=${issue_arg#*/}
+ # Strip suffixes like /some-branch-description
+ issue_arg=${issue_arg%%/*}
+ # Return the value
+ echo $issue_arg
+}
+```
#### Debugging usage