Created
September 26, 2018 09:20
-
-
Save blakef/8c6345e7b257f967cddca1a04a059475 to your computer and use it in GitHub Desktop.
Open to a jira ticket looking at: argument, clipboard or current repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL=https://<megacorp>.atlassian.net/browse/ | |
TICKET_PREFIX=FOO | |
function validTicket() { | |
FOUND=`echo "$1" | sed 's/.*\($TICKET_PREFIX-[0-9]\+\).*/\1/Ig' | tr [:lower:] [:upper:]` | |
if [[ "$FOUND" == WYN* ]]; then | |
open "$URL$FOUND" | |
exit 0 | |
fi | |
} | |
clipboard=`pbpaste` | |
git=`git rev-parse --abbrev-ref HEAD 2>/dev/null` | |
validTicket "$1" | |
validTicket "$clipboard" | |
validTicket "$git" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment