Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
fix(commands/issue/update): check flag conflicts before anything
Browse files Browse the repository at this point in the history
  • Loading branch information
maxice8 committed Dec 23, 2020
1 parent d4a3550 commit 714f456
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions commands/issue/update/issue_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func NewCmdUpdate(f *cmdutils.Factory) *cobra.Command {
if cmd.Flags().Changed("lock-discussion") && cmd.Flags().Changed("unlock-discussion") {
return &cmdutils.FlagError{Err: errors.New("--lock-discussion and --unlock-discussion can't be used together")}
}
if cmd.Flags().Changed("confidential") && cmd.Flags().Changed("public") {
return &cmdutils.FlagError{Err: errors.New("--public and --confidential can't be used together")}
}

apiClient, err := f.HttpClient()
if err != nil {
Expand Down Expand Up @@ -63,10 +66,6 @@ func NewCmdUpdate(f *cmdutils.Factory) *cobra.Command {
if m, _ := cmd.Flags().GetStringArray("unlabel"); len(m) != 0 {
l.RemoveLabels = gitlab.Labels(m)
}

if cmd.Flags().Changed("confidential") && cmd.Flags().Changed("public") {
return &cmdutils.FlagError{Err: errors.New("--public and --confidential can't be used together")}
}
if m, _ := cmd.Flags().GetBool("public"); m {
l.Confidential = gitlab.Bool(false)
}
Expand Down

0 comments on commit 714f456

Please sign in to comment.