2bbe6aba8f90dabdb3f7e2caaf12b6a3ecaf5f1f

Author
Paul Redmond <paulrredmond@gmail.com>
Committer
Paul Redmond <paulrredmond@gmail.com>
Date

Message

Jira ticket shortcut to browse existing issues or create a new issue.

Diff

 1diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..c8b17d71facfc82773160bdd9cd1b26852e2b552
 4--- /dev/null
 5+++ b/plugins/jira/jira.plugin.zsh
 6@@ -0,0 +1,22 @@
 7+# To use: add a .jira-url file containing your 
 8+# Jira project's base url in the root of your project.
 9+# Example: https://name.jira.com
10+# Usage: jira           # opens a new issue
11+#        jira ABC-123   # Opens an existing issue
12+open_jira_issue () {
13+  if [ ! -f .jira-url ]; then
14+    echo "There is no .jira-url file in the current directory or your home folder..."
15+    return 0;
16+  else
17+    jira_url=$(cat .jira-url);
18+    if [ -z "$1" ]; then
19+      echo "Opening new issue";
20+      `open $jira_url/secure/CreateIssue!default.jspa`;
21+    else
22+      echo "Opening issue #$1";
23+      `open $jira_url/issues/$1`;
24+    fi
25+  fi
26+}
27+
28+alias jira='open_jira_issue'