Skip to content

Instantly share code, notes, and snippets.

@halcyon
Last active December 11, 2015 16:38
Show Gist options
  • Save halcyon/4629115 to your computer and use it in GitHub Desktop.
Save halcyon/4629115 to your computer and use it in GitHub Desktop.
jira zsh plugin
# To use: add a .jira-url file in the base of your project
# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
# .jira-url in the current directory takes precedence
#
# If you use Rapid Board, set:
#JIRA_RAPID_BOARD="yes"
# in you .zshrc
#
# Setup: cd to/my/project
# echo "https://name.jira.com" >> .jira-url
# Usage: jira # opens a new issue
# jira ABC-123 # Opens an existing issue
open_jira_issue () {
if [ -f .jira ]; then
source .jira
else
echo "JIRA URL & PID is not specified anywhere."
return 0
fi
if [ -z "$1" ]; then
echo "Opening new issue"
`open ${JIRA_URL}/secure/CreateIssue!default.jspa?selectedProjectId=$PROJECT_ID`
else
echo "Opening issue #$1"
if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
`open $JIRA_URL/issues/$1`
else
`open $JIRA_URL/browse/$1`
fi
fi
}
alias jira='open_jira_issue'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment