-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
A-parsingArea: Parser's logic and needs it changed somehow.Area: Parser's logic and needs it changed somehow.C-enhancementCategory: Raise on the bar on expectationsCategory: Raise on the bar on expectationsS-waiting-on-designStatus: Waiting on user-facing design to be resolved before implementingStatus: Waiting on user-facing design to be resolved before implementing
Description
With clap today, each value source needs to be hard coded, including
default_valuedefault_missing_valuedefault_value_ifenv
When new use cases arise, users either have to
- Hard code the values
- Get a new feature approved and contributed which runs up against Reduce compilation time #2037 / Binary size could be smaller #1365
It would help if clap had an API for users to provide their own systems for this. See also #3476.
Example unsupported use cases
- Have an argument imply others and set them? #4788 implied values
- Implied values should have the same value source as the caused value
- Ideally we let users leverage an actions default value / default missing value
- Add method to parse environment variables from custom source #4607: custom env variable source for wasm
- Add simple prompts #1634
default_value and default_missing_value are integral to Actions, so I'm thinking we leave those as built-in
Requirements
- Know the source for existing relevant arg values
- Able to set the source for value
- Able to augment the help description of a specific argument with details
- Ideally help uses with
ValueSourceprecedence - Ideally leverage built-in
Actionbehavior - Ideally not so unergonomic to be unuseful
Tools
- Plugin API to allow storing arbitrary data on Command/Arg
- Blanket
implof a trait for functions Intoto allow custom plugin data to be converted to the plugin type
null-dev and karmux
Metadata
Metadata
Assignees
Labels
A-parsingArea: Parser's logic and needs it changed somehow.Area: Parser's logic and needs it changed somehow.C-enhancementCategory: Raise on the bar on expectationsCategory: Raise on the bar on expectationsS-waiting-on-designStatus: Waiting on user-facing design to be resolved before implementingStatus: Waiting on user-facing design to be resolved before implementing