Use closure-scoped variable to catch --remove-milestone option
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
This commit is contained in:
parent
842562d3db
commit
a73ae65ca8
1 changed files with 4 additions and 4 deletions
|
|
@ -32,7 +32,6 @@ type EditOptions struct {
|
|||
Interactive bool
|
||||
|
||||
prShared.Editable
|
||||
RemoveMilestone bool
|
||||
}
|
||||
|
||||
func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Command {
|
||||
|
|
@ -47,6 +46,7 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
|
|||
}
|
||||
|
||||
var bodyFile string
|
||||
var removeMilestone bool
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "edit {<numbers> | <urls>}",
|
||||
|
|
@ -100,7 +100,7 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
|
|||
if err := cmdutil.MutuallyExclusive(
|
||||
"specify only one of `--milestone` or `--remove-milestone`",
|
||||
flags.Changed("milestone"),
|
||||
opts.RemoveMilestone,
|
||||
removeMilestone,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
|
|||
if flags.Changed("add-project") || flags.Changed("remove-project") {
|
||||
opts.Editable.Projects.Edited = true
|
||||
}
|
||||
if flags.Changed("milestone") || opts.RemoveMilestone {
|
||||
if flags.Changed("milestone") || removeMilestone {
|
||||
opts.Editable.Milestone.Edited = true
|
||||
|
||||
// Note that when `--remove-milestone` is provided, the value of
|
||||
|
|
@ -156,7 +156,7 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
|
|||
cmd.Flags().StringSliceVar(&opts.Editable.Projects.Add, "add-project", nil, "Add the issue to projects by `name`")
|
||||
cmd.Flags().StringSliceVar(&opts.Editable.Projects.Remove, "remove-project", nil, "Remove the issue from projects by `name`")
|
||||
cmd.Flags().StringVarP(&opts.Editable.Milestone.Value, "milestone", "m", "", "Edit the milestone the issue belongs to by `name`")
|
||||
cmd.Flags().BoolVar(&opts.RemoveMilestone, "remove-milestone", false, "Remove the milestone association from the issue")
|
||||
cmd.Flags().BoolVar(&removeMilestone, "remove-milestone", false, "Remove the milestone association from the issue")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue