Skip to content

Commit

Permalink
fix "edit" default option, change how defaults are dealt with for fil…
Browse files Browse the repository at this point in the history
…ters
  • Loading branch information
Cory Bennett committed Sep 14, 2015
1 parent 968a9df commit 4265913
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ all:
done

fmt:
gofmt -s -w jira && git commit -a -m "gofmt"
gofmt -s -w jira

install:
export GOBIN=~/bin && ${MAKE} build
Expand Down
12 changes: 6 additions & 6 deletions jira/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ Command Options:

defaults := map[string]interface{}{
"user": user,
"issuetype": "Bug",
"watcher": user,
"queryfields": defaultQueryFields,
"directory": fmt.Sprintf("%s/.jira.d/templates", home),
"sort": defaultSort,
Expand Down Expand Up @@ -228,15 +226,19 @@ Command Options:
log.Debug("opts: %s", opts)

setEditing := func(dflt bool) {
log.Debug("Default Editing: %t", dflt)
if dflt {
if val, ok := opts["noedit"].(bool); ok && val {
log.Debug("Setting edit = false")
opts["edit"] = false
} else {
log.Debug("Setting edit = true")
opts["edit"] = true
}
} else {
if val, ok := opts["edit"].(bool); ok && !val {
opts["edit"] = false
if _, ok := opts["edit"].(bool); !ok {
log.Debug("Setting edit = %t", dflt)
opts["edit"] = dflt
}
}
}
Expand All @@ -257,9 +259,7 @@ Command Options:
var data interface{}
if data, err = c.FindIssues(); err == nil {
issues := data.(map[string]interface{})["issues"].([]interface{})
log.Notice("Found Issues: %d", len(issues))
for _, issue := range issues {
log.Notice("Issue: %s", issue.(map[string]interface{})["key"])
if err = c.CmdEdit(issue.(map[string]interface{})["key"].(string)); err != nil {
switch err.(type) {
case cli.NoChangesFound:
Expand Down

0 comments on commit 4265913

Please sign in to comment.