summaryrefslogtreecommitdiff
path: root/plugins/jira/jira.plugin.zsh
diff options
context:
space:
mode:
authorPeter Tillemans <pti@snamellit.com>2013-01-02 09:42:14 +0100
committerPeter Tillemans <pti@snamellit.com>2013-01-02 09:42:14 +0100
commit587832f15579398e54690e62ea588178e951f8f8 (patch)
tree1e2149e743710e2c72a567a042606333bbad88da /plugins/jira/jira.plugin.zsh
parent55cc936d4e6d88f18518cedc9574b1df10702f8b (diff)
parent80a603259657acab97badbae20003b5a34c901f9 (diff)
downloadzsh-587832f15579398e54690e62ea588178e951f8f8.tar.gz
zsh-587832f15579398e54690e62ea588178e951f8f8.tar.bz2
zsh-587832f15579398e54690e62ea588178e951f8f8.zip
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/jira/jira.plugin.zsh')
-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 636e4619e..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/issues/$1`;
+ `open $jira_url/browse/$1`
fi
fi
}