Allow global args in top-level multicall #4521
Labels
A-builder
Area: Builder API
C-enhancement
Category: Raise on the bar on expectations
S-waiting-on-decision
Status: Waiting on a go/no-go before implementing
Please complete the following tasks
Clap Version
4.0.27
Describe your use case
When writing a multicall program, I have some options that I'd like to be available to all commands. In addition, to reduce boilerplate, I would like them to be in the top-level struct.
A prime example of this would be log level, which is set once, just after parsing the commandline, before entering a specific subcommand.
Describe the solution you'd like
This looks good enough - as is, this is rejected by debug asserts.
Alternatives, if applicable
A workaround would be to add the log level enum as an option on all subcommands - doable, but seems to require some amount of repetitive code, which is always an issue when it comes to later changes.
The amount of repetition could perhaps be eased by using a declarative macro, but those are somewhat annoying to write and not everyone is comfortable with them.
Additional Context
No response
The text was updated successfully, but these errors were encountered: