face icon indicating copy to clipboard operation
face copied to clipboard

Add `.refresh()` method to `Parser`

Open moshez opened this issue 4 years ago • 2 comments

If I change a subparser, I want the parser to notice the change.

It is ok if it's explicit.

moshez avatar Mar 14 '20 23:03 moshez

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!

mahmoud avatar Mar 17 '20 07:03 mahmoud

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!

moshez avatar Sep 02 '20 03:09 moshez