Skip to content

Commit

Permalink
fix default values to load after parsing configs
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Oct 28, 2017
1 parent f23b1c4 commit c9b5054
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
6 changes: 3 additions & 3 deletions jiracmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ func CmdEditRegistry() *jiracli.CommandRegistryEntry {
"Edit issue details",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
if opts.QueryFields == "" {
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype,comments,description,votes,created,customfield_10110,components"
}
return CmdEditUsage(cmd, &opts, fig)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.QueryFields == "" {
opts.QueryFields = "assignee,created,priority,reporter,status,summary,updated,issuetype,comments,description,votes,created,customfield_10110,components"
}
return CmdEdit(o, globals, &opts)
},
}
Expand Down
6 changes: 3 additions & 3 deletions jiracmd/epicList.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func CmdEpicListRegistry() *jiracli.CommandRegistryEntry {
"Prints list of issues for an epic with optional search criteria",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
return CmdEpicListUsage(cmd, &opts, fig)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.MaxResults == 0 {
opts.MaxResults = 500
}
Expand All @@ -35,9 +38,6 @@ func CmdEpicListRegistry() *jiracli.CommandRegistryEntry {
if opts.Sort == "" {
opts.Sort = "priority asc, key"
}
return CmdEpicListUsage(cmd, &opts, fig)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
return CmdEpicList(o, globals, &opts)
},
}
Expand Down
6 changes: 3 additions & 3 deletions jiracmd/exportTemplates.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func CmdExportTemplatesRegistry() *jiracli.CommandRegistryEntry {
"Export templates for customizations",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
if opts.Dir == "" {
opts.Dir = fmt.Sprintf("%s/.jira.d/templates", jiracli.Homedir())
}
return CmdExportTemplatesUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.Dir == "" {
opts.Dir = fmt.Sprintf("%s/.jira.d/templates", jiracli.Homedir())
}
return CmdExportTemplates(globals, &opts)
},
}
Expand Down
6 changes: 3 additions & 3 deletions jiracmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func CmdListRegistry() *jiracli.CommandRegistryEntry {
"Prints list of issues for given search criteria",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
return CmdListUsage(cmd, &opts, fig)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.MaxResults == 0 {
opts.MaxResults = 500
}
Expand All @@ -36,9 +39,6 @@ func CmdListRegistry() *jiracli.CommandRegistryEntry {
if opts.Sort == "" {
opts.Sort = "priority asc, key"
}
return CmdListUsage(cmd, &opts, fig)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
return CmdList(o, globals, &opts)
},
}
Expand Down
6 changes: 3 additions & 3 deletions jiracmd/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func CmdRequestRegistry() *jiracli.CommandRegistryEntry {
"Open issue in requestr",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
if opts.Method == "" {
opts.Method = "GET"
}
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
jiracli.GJsonQueryUsage(cmd, &opts.CommonOptions)
return CmdRequestUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.Method == "" {
opts.Method = "GET"
}
return CmdRequest(o, globals, &opts)
},
}
Expand Down
6 changes: 3 additions & 3 deletions jiracmd/subtask.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ func CmdSubtaskRegistry() *jiracli.CommandRegistryEntry {
"Subtask issue",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
if opts.IssueType == "" {
opts.IssueType = "Sub-task"
}
return CmdSubtaskUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.IssueType == "" {
opts.IssueType = "Sub-task"
}
return CmdSubtask(o, globals, &opts)
},
}
Expand Down
6 changes: 3 additions & 3 deletions jiracmd/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func CmdTransitionRegistry(transition string) *jiracli.CommandRegistryEntry {
help,
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
if opts.Transition == "" {
opts.Transition = transition
}
return CmdTransitionUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.Transition == "" {
opts.Transition = transition
}
return CmdTransition(o, globals, &opts)
},
}
Expand Down
7 changes: 3 additions & 4 deletions jiracmd/unexportTemplates.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ func CmdUnexportTemplatesRegistry() *jiracli.CommandRegistryEntry {
"Remove unmodified exported templates",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
if opts.Dir != "" {
opts.Dir = fmt.Sprintf("%s/.jira.d/templates", jiracli.Homedir())
}

return CmdExportTemplatesUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
if opts.Dir != "" {
opts.Dir = fmt.Sprintf("%s/.jira.d/templates", jiracli.Homedir())
}
return CmdUnexportTemplates(globals, &opts)
},
}
Expand Down

0 comments on commit c9b5054

Please sign in to comment.