-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Is there a way to set conflicting
and implied
flags in cobra
?
conflicting
When I am allowing the user to set some output mode to json
/csv
, I would have two flags (as opposed to --output json|csv
just to make the users' life easier)
--json
--csv
However, setting these two flags together like exampleCmd subCmd --json --csv
does not make sense and hence needs to be blocked.
implied
At the same time, there are flags which may have to be used together to make sense (implied flags).
Example:= a credentials combo (username
/password
or apikey
/apisecret
)
Using one without the other does not make sense.
Ofcourse we could have custom logic in the handlers to take care of this, but that would mean repetition on every handler (even if it's a simple function call).
Does cobra support these in some way?
If not, is this a planned feature?