Skip to content

Instantly share code, notes, and snippets.

@jnraine
Created October 7, 2014 00:15
Show Gist options
  • Save jnraine/78c26823f965b36494d0 to your computer and use it in GitHub Desktop.
Save jnraine/78c26823f965b36494d0 to your computer and use it in GitHub Desktop.
Helper to open JIRA tickets from Terminal
# Usage:
# ticket <= opens ticket associated with the branch you're on (for branch clio-1234-fix-the-thing, opens CLIO-1234)
# ticket 5678 <= opens CLIO-5678
ticket () {
ticketNumber=$1
if [ "$ticketNumber" -eq "" ]
then
ticketNumber=$(git rev-parse --abbrev-ref HEAD | ruby -e "branch=gets.downcase;print branch.match(/^clio-(\d+)/)[1] if branch.start_with?('clio-')")
fi
if [ "$ticketNumber" -eq "" ]
then
echo "Enter ticket number or checkout ticket-based branch (e.g., clio-1234-fix-the-thing)"
else
open "https://themis.atlassian.net/browse/CLIO-${ticketNumber}"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment