diff options
author | Robby Russell <robby@planetargon.com> | 2012-12-03 07:25:35 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2012-12-03 07:25:35 -0800 |
commit | 2f0717cb76bf09ce544f64aa938191da6523a40c (patch) | |
tree | 2d404c30fcc170430a56ae38b61d218d168edfd4 | |
parent | 1ad2104d7a408821805f662d4cbe810fd2d6c2db (diff) | |
parent | 39e5c9a6d7a88feb570f340ca52e87c8ff8cce61 (diff) | |
download | zsh-2f0717cb76bf09ce544f64aa938191da6523a40c.tar.gz zsh-2f0717cb76bf09ce544f64aa938191da6523a40c.tar.bz2 zsh-2f0717cb76bf09ce544f64aa938191da6523a40c.zip |
Merge pull request #1459 from tresni/patch-3
Backwards Compatible Jira URLs #1378
-rw-r--r-- | plugins/jira/jira.plugin.zsh | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index de8d10529..b91f93c95 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -1,20 +1,36 @@ # 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-url ]; then - echo "There is no .jira-url file in the current directory..." - return 0; + if [ -f .jira-url ]; then + jira_url=$(cat .jira-url) + elif [ -f ~/.jira-url ]; then + jira_url=$(cat ~/.jira-url) + elif [[ "x$JIRA_URL" != "x" ]]; then + jira_url=$JIRA_URL else - jira_url=$(cat .jira-url); - if [ -z "$1" ]; then - echo "Opening new issue"; - `open $jira_url/secure/CreateIssue!default.jspa`; + echo "JIRA url is not specified anywhere." + return 0 + fi + + if [ -z "$1" ]; then + echo "Opening new issue" + `open $jira_url/secure/CreateIssue!default.jspa` + else + echo "Opening issue #$1" + if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then + `open $jira_url/issues/$1` else - echo "Opening issue #$1"; - `open $jira_url/browse/$1`; + `open $jira_url/browse/$1` fi fi } |