Move field value flag and clear flag exclusivity one level higher up to RunE

This commit is contained in:
Arun 2023-09-29 11:54:14 -07:00
parent cfe055c29e
commit 6f6e179c49
No known key found for this signature in database

View file

@ -83,6 +83,14 @@ func NewCmdEditItem(f *cmdutil.Factory, runF func(config editItemConfig) error)
return err
}
if err := cmdutil.MutuallyExclusive(
"cannot use `--text`, `--number`, `--date`, `--single-select-option-id` or `--iteration-id` in conjunction with `--clear`",
opts.text != "" || opts.number != 0 || opts.date != "" || opts.singleSelectOptionID != "" || opts.iterationID != "",
opts.clear,
); err != nil {
return err
}
client, err := client.New(f)
if err != nil {
return err
@ -135,9 +143,6 @@ func runEditItem(config editItemConfig) error {
// TODO: offer to fetch interactively
return cmdutil.FlagErrorf("project-id must be provided for use with the clear flag")
}
if config.opts.text != "" || config.opts.number != 0 || config.opts.date != "" || config.opts.singleSelectOptionID != "" || config.opts.iterationID != "" {
return cmdutil.FlagErrorf("cannot use this flag in conjunction with clear")
}
query, variables := buildClearItem(config)
err := config.client.Mutate("ClearItemFieldValue", query, variables)
if err != nil {