From 6d5b1f1e3be483bb09315d22a2175d1c97998167 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Wed, 1 Nov 2017 21:09:10 +0800 Subject: [PATCH] Allow jira default action file based setting (#6367) --- 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 fe1772cd8..7d4e5b921 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -2,13 +2,19 @@ # # See README.md for details -: ${JIRA_DEFAULT_ACTION:=new} - function jira() { emulate -L zsh - local action=${1:=$JIRA_DEFAULT_ACTION} + local action jira_url jira_prefix + if [[ -f .jira-default-action ]]; then + action=$(cat .jira-default-action) + elif [[ -f ~/.jira-default-action ]]; then + action=$(cat ~/.jira-default-action) + elif [[ -n "${JIRA_DEFAULT_ACTION}" ]]; then + action=${JIRA_DEFAULT_ACTION} + else + action="new" + fi - local jira_url jira_prefix if [[ -f .jira-url ]]; then jira_url=$(cat .jira-url) elif [[ -f ~/.jira-url ]]; then