summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Hartvigsen <brian.andrew@brianandjenny.com>2012-12-02 22:59:05 -0700
committerBrian Hartvigsen <brian.andrew@brianandjenny.com>2012-12-02 22:59:05 -0700
commit39e5c9a6d7a88feb570f340ca52e87c8ff8cce61 (patch)
tree22b23427db4b4244c3ec7c8ad9395d6dfc0beca1
parent51e05b7579a26266a0ed26398ab9eb5071800cd8 (diff)
downloadzsh-39e5c9a6d7a88feb570f340ca52e87c8ff8cce61.tar.gz
zsh-39e5c9a6d7a88feb570f340ca52e87c8ff8cce61.tar.bz2
zsh-39e5c9a6d7a88feb570f340ca52e87c8ff8cce61.zip
Backwards Compatible Jira URLs #1378
Adds support for Rapid Board without breaking backwards compatibility (like #1378) Allows JIRA url to be set in .zshrc, current directory, and/or home directory.
-rw-r--r--plugins/jira/jira.plugin.zsh34
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
}