From a5c7a133c018d0c3140e6b1985f29d2ac418aa8f Mon Sep 17 00:00:00 2001 From: Cory Bennett Date: Tue, 24 Feb 2015 17:48:59 -0800 Subject: [PATCH] fix default JIRA_OPERATION env variable --- jira/main.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jira/main.go b/jira/main.go index 159a0b9..529727c 100644 --- a/jira/main.go +++ b/jira/main.go @@ -296,6 +296,7 @@ func parseYaml(file string, opts map[string]string) { } func populateEnv(args map[string]interface{}) { + foundOp := false for key, val := range args { if val != nil && strings.HasPrefix(key, "--") { if key == "--override" { @@ -328,23 +329,29 @@ func populateEnv(args map[string]interface{}) { // lower case strings are operations if strings.ToLower(key) == key { if key == "ls" && val.(bool) { + foundOp = true os.Setenv("JIRA_OPERATION", "list") } else if key == "b" && val.(bool) { + foundOp = true os.Setenv("JIRA_OPERATION", "browse") } else if key == "trans" && val.(bool) { + foundOp = true os.Setenv("JIRA_OPERATION", "transition") } else if key == "give" && val.(bool) { + foundOp = true os.Setenv("JIRA_OPERATION", "assign") } else if val.(bool) { + foundOp = true os.Setenv("JIRA_OPERATION", key) - } else { - os.Setenv("JIRA_OPERATION", "view") } } else { os.Setenv(fmt.Sprintf("JIRA_%s", key), val.(string)) } } } + if !foundOp { + os.Setenv("JIRA_OPERATION", "view") + } } func loadConfigs(opts map[string]string) {