Conflicting and Implied flags #1238
Labels
area/flags-args
Changes to functionality around command line flags and args
kind/feature
A feature request for cobra; new or enhanced behavior
lifecycle/needs-proposal
For large features/bugs that need a proposal and community buy in
Is there a way to set
conflicting
andimplied
flags incobra
?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
orapikey
/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?
The text was updated successfully, but these errors were encountered: