Add jira shortcut
This commit is contained in:
parent
510ca0e5e3
commit
e947389b45
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# jira - jump to a Jira ticket in the browser, based on Git branch name convention.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "$JIRADOMAIN" ]; then
|
||||||
|
echo 'set $JIRADOMAIN first'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
branchname="$(git bn)"
|
||||||
|
if ! echo "$branchname" | grep -q "/"; then
|
||||||
|
echo "no ticket number found in branch name: $branchname"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ticket=$(echo "$branchname" | cut -d "/" -f1 | tr '[:lower:]' '[:upper:]')
|
||||||
|
|
||||||
|
if [ $(uname -s) = "Linux" ]; then
|
||||||
|
progname="xdg-open"
|
||||||
|
else
|
||||||
|
progname="open" # macOS
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval "$progname $JIRADOMAIN/browse/$ticket"
|
1
zshrc
1
zshrc
|
@ -77,6 +77,7 @@ alias gp="git push"
|
||||||
alias gst="git status"
|
alias gst="git status"
|
||||||
alias gt="go test"
|
alias gt="go test"
|
||||||
alias gta="go test ./..."
|
alias gta="go test ./..."
|
||||||
|
alias ji="jira"
|
||||||
alias k9="kill -9"
|
alias k9="kill -9"
|
||||||
alias ll="exa -l --group-directories-first --git"
|
alias ll="exa -l --group-directories-first --git"
|
||||||
alias ls="exa --color=auto"
|
alias ls="exa --color=auto"
|
||||||
|
|
Loading…
Reference in New Issue