b1da3bbc6f5e26cd0b06cd858e696d4f47f340d2

Author
Patryk Małek <malekpatryk@gmail.com>
Committer
Patryk Małek <malekpatryk@gmail.com>
Date

Message

Adding ability to add JIRA_PREFIX as an env variable (e.g. in .zshrc) and minor refactor to bash curly variable braces

Diff

 1diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
 2index ca540c84c1229cbea6d0bb0ae721499e2ce41364..a22e1936341878d1137faae393808d5fca6bc76a 100644
 3--- a/plugins/jira/jira.plugin.zsh
 4+++ b/plugins/jira/jira.plugin.zsh
 5@@ -1,6 +1,7 @@
 6 # To use: add a .jira-url file in the base of your project
 7 #         You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
 8-#         .jira-url in the current directory takes precedence
 9+#         .jira-url in the current directory takes precedence. The same goes with .jira-prefix
10+#         and JIRA_PREFIX.
11 #
12 # If you use Rapid Board, set:
13 #JIRA_RAPID_BOARD="true"
14@@ -22,8 +23,8 @@ open_jira_issue () {
15     jira_url=$(cat .jira-url)
16   elif [ -f ~/.jira-url ]; then
17     jira_url=$(cat ~/.jira-url)
18-  elif [[ "x$JIRA_URL" != "x" ]]; then
19-    jira_url=$JIRA_URL
20+  elif [[ "${JIRA_URL}" != "" ]]; then
21+    jira_url=${JIRA_URL}
22   else
23     echo "JIRA url is not specified anywhere."
24     return 1
25@@ -33,6 +34,8 @@ open_jira_issue () {
26     jira_prefix=$(cat .jira-prefix)
27   elif [ -f ~/.jira-prefix ]; then
28     jira_prefix=$(cat ~/.jira-prefix)
29+  elif [[ "${JIRA_PREFIX}" != "" ]]; then
30+    jira_prefix=${JIRA_PREFIX}
31   else
32     jira_prefix=""
33   fi
34@@ -51,7 +54,7 @@ open_jira_issue () {
35       echo "Opening issue #$1"
36     fi
37     
38-    if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
39+    if [[ "$JIRA_RAPID_BOARD" = "true" ]]; then
40       $open_cmd  "$jira_url/issues/$jira_prefix$1$addcomment"
41     else
42       $open_cmd  "$jira_url/browse/$jira_prefix$1$addcomment"
43@@ -61,7 +64,7 @@ open_jira_issue () {
44 
45 jira_name () {
46   if [[ -z "$1" ]]; then
47-    if [[ "x${JIRA_NAME}" != "x" ]]; then
48+    if [[ "${JIRA_NAME}" != "" ]]; then
49       jira_name=${JIRA_NAME}
50     else
51       echo "JIRA_NAME not specified"