the default derive for booleans should also handle explicit --flag=true
, --flag=false
#5577
Open
2 tasks done
Labels
A-derive
Area: #[derive]` macro API
C-enhancement
Category: Raise on the bar on expectations
M-breaking-change
Meta: Implementing or merging this will introduce a breaking change.
S-waiting-on-decision
Status: Waiting on a go/no-go before implementing
Please complete the following tasks
Clap Version
4
Describe your use case
I searched around for related issues but only saw stuff like --flag/--no-flag which is not what this is about, or posts that were actually using this pattern in examples (I'm not the first one to need this, and have seen it elsewhere). In things such as automated scripts, sometimes I have a pattern of usage like passing
format!("... --flag={val}")
. However, if the value is a boolean, it does not allow things like--flag=true
or--flag=false
, only passing--flag
by itself which requires annoying conditionals in the scripts. What I have to do is applyto every single boolean (note that it still allows
--flag
by itself and the absence of the flag to work as before). This is obviously quite annoying to use if there are a lot of booleans across many structs.Describe the solution you'd like
Simply make this the default for booleans. I feel like this is a property of some other command argument systems I've seen before, but can't remember.
Alternatives, if applicable
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: