Skip to content

Commit

Permalink
fix default JIRA_OPERATION env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Feb 25, 2015
1 parent ebf1700 commit 82fd9b9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jira/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 82fd9b9

Please sign in to comment.