From 37f45eb621b04a1286ac1667b7474111e6e0b4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Tue, 7 Jul 2015 20:03:58 +0200 Subject: [PATCH] Making variables local in jira plugin --- plugins/jira/jira.plugin.zsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 769bf236..7839e2a8 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -19,6 +19,7 @@ open_jira_issue () { open_cmd='xdg-open' fi + local jira_url if [ -f .jira-url ]; then jira_url=$(cat .jira-url) elif [ -f ~/.jira-url ]; then @@ -30,6 +31,7 @@ open_jira_issue () { return 1 fi + local jira_prefix if [ -f .jira-prefix ]; then jira_prefix=$(cat .jira-prefix) elif [ -f ~/.jira-prefix ]; then @@ -45,7 +47,7 @@ open_jira_issue () { $open_cmd "${jira_url}/secure/CreateIssue!default.jspa" elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then jira_query $@ - else + else local addcomment='' if [[ "$2" == "m" ]]; then addcomment="#add-comment" @@ -53,11 +55,11 @@ open_jira_issue () { else echo "Opening issue #$1" fi - + if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then - $open_cmd "$jira_url/issues/$jira_prefix$1$addcomment" + $open_cmd "$jira_url/issues/$jira_prefix$1$addcomment" else - $open_cmd "$jira_url/browse/$jira_prefix$1$addcomment" + $open_cmd "$jira_url/browse/$jira_prefix$1$addcomment" fi fi } @@ -76,7 +78,11 @@ jira_name () { } jira_query () { + local jira_name + local verb verb="$1" + local lookup + local preposition if [[ "${verb}" = "reported" ]]; then lookup=reporter preposition=by