face
face copied to clipboard
Add `.refresh()` method to `Parser`
If I change a subparser, I want the parser to notice the change.
It is ok if it's explicit.
I've occasionally wanted this, as well. My only hesitation in supporting it has been:
The way I'd like to prescribe subparsers/subcommands be handled involves building from the leaf up. Ideally the leaf parsers wouldn't need to know where they're embedded in order to update them.
Maybe making it an explicit .refresh()
with some admonishments in the soon-to-exist docs might satisfy.
I just need to think through what the implications might be at the Command
layer. I'll keep you posted!
Another option is to have a more explicit immutable builder pattern. But one or the other is probably good.
Let me know what you decide!