mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
refactor for GlobalOptions and CommonOptions
This commit is contained in:
+7
-10
@@ -7,27 +7,24 @@ import (
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
func CmdTakeRegistry(fig *figtree.FigTree, o *oreo.Client) *jiracli.CommandRegistryEntry {
|
||||
func CmdTakeRegistry(o *oreo.Client) *jiracli.CommandRegistryEntry {
|
||||
opts := AssignOptions{}
|
||||
|
||||
return &jiracli.CommandRegistryEntry{
|
||||
"Assign issue to yourself",
|
||||
func() error {
|
||||
opts.Assignee = opts.User.Value
|
||||
return CmdAssign(o, &opts)
|
||||
},
|
||||
func(cmd *kingpin.CmdClause) error {
|
||||
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
||||
jiracli.LoadConfigs(cmd, fig, &opts)
|
||||
return CmdAssignUsage(cmd, &opts)
|
||||
},
|
||||
func(globals *jiracli.GlobalOptions) error {
|
||||
opts.Assignee = globals.User.Value
|
||||
return CmdAssign(o, globals, &opts)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func CmdTakeUsage(cmd *kingpin.CmdClause, opts *AssignOptions) error {
|
||||
if err := jiracli.GlobalUsage(cmd, &opts.GlobalOptions); err != nil {
|
||||
return err
|
||||
}
|
||||
jiracli.BrowseUsage(cmd, &opts.GlobalOptions)
|
||||
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
|
||||
cmd.Arg("ISSUE", "issue to assign").Required().StringVar(&opts.Issue)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user