Last active
September 14, 2018 16:38
-
-
Save ewieberappc/f3fdba90e1f6b7643b6c to your computer and use it in GitHub Desktop.
Search JIRA and open tickets from the command line
This file contains hidden or 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
USAGE: | |
$ jira [ticket, ...] - Open the tickets supplied in your default browser | |
$ jira -s [...] - Search JIRA with the supplied arguments. Supports JIRA Smart Query | |
$ jira me - Opens JIRA to the "Reported by me" page | |
$ jira - Use previous command as arguments for Jira command. Prints help if previous command is a Jira command | |
$ jira -h - Opens the help URL (this page) | |
INSTALLATION: | |
1. Download the executable file to a folder (recommended '~/bin') | |
2. Add the path to the folder to your PATH in your .bash_profile (export PATH=$PATH:~/bin) | |
3. Restart your terminal or run '. ~/.bash_profile' |
This file contains hidden or 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
case "$1" in -h|--help) HELP='https://gist.github.com/ewieberappc/f3fdba90e1f6b7643b6c'; echo -ne '\t'$'\e[37m''Opening help URL: '"$HELP"'\n'$'\e[0m'; open "$HELP"; exit;; me) open 'https://jira.appcelerator.org/issues/?filter=-2';; "") set -o history; IN=$( history | tail -2 | head -1 | sed 's/[ 0-9]*//' ); if [[ "$IN" != 'jira'* ]]; then echo -ne "\r"; ${FUNCNAME[0]} $IN; else echo -ne "\r"; ${FUNCNAME[0]} -h; fi; exit;; -s|--search) STR=''; shift; while [ "${#}" -gt 0 ]; do if [[ "$STR" == '' ]]; then STR="$1"; else STR+='+'"$1"; fi; shift; done; STR=${STR// /\+}; open 'https://jira.appcelerator.org/issues/?jql='$STR; echo; echo -e '\nPerforming JIRA search\n';; *) echo; echo -e '\nOpening:'; for arg in "$@"; do TIC='https://jira.appcelerator.org/browse/'$(echo $arg | sed -n 's/\([a-zA-Z]*\)\(\-*\)\([0-9]*\)/\1-\3/p'); open $TIC; echo -e $TIC; done; echo;; esac; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment