-
Notifications
You must be signed in to change notification settings - Fork 150
Feature Request: useDefault, if implemented #142
Copy link
Copy link
Closed
Labels
enhancementWe would love to have this feature! Feel free to supply a PRWe would love to have this feature! Feel free to supply a PRneed-designThe concrete desing is uncertain, please get involved in the discussion before sending a PRThe concrete desing is uncertain, please get involved in the discussion before sending a PR
Description
Metadata
Metadata
Assignees
Labels
enhancementWe would love to have this feature! Feel free to supply a PRWe would love to have this feature! Feel free to supply a PRneed-designThe concrete desing is uncertain, please get involved in the discussion before sending a PRThe concrete desing is uncertain, please get involved in the discussion before sending a PR
In the same vein as convenience features like #134 and #18, add support for the automatic use of
Default, if implemented. This would be a breaking change if done poorly, and in any case I'm not sure if the procedural macro system is powerful enough to "detect" trait implementations. I'd therefore propose the following syntax, inspired by #18:Basically, if the
defaultkey is present, then use theDefaulttrait if the flag isn't given. I'd also be okay withdefault_valuebeing the key, but my suggestion is that it be slightly different because under the hood, something slightly different is happening. This isn't usingclap'sdefault_valuebuilder method, since it requires a str. Rather,structoptitself will handle the logic for filling in the default value if necessary.This could have implications for #123, as well.