Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse incrementally, enabling subcommands #281

Closed
wants to merge 2 commits into from

Conversation

burke
Copy link

@burke burke commented Nov 14, 2023

By rewriting parse to accumulate arguments as we go, we can easily add a condition to stop parsing when a subcommand is detected.

By rewriting parse to accumulate arguments as we go, we can easily add a
condition to stop parsing when a subcommand is detected.
@leejarvis
Copy link
Owner

@burke Thanks for the idea and the code change. I'm still quite undecided on the idea of supporting subcommands in general to be honest, and it's something I want to be careful about re-introducing (despite the existing and additional tests all pointing to success).

This change doesn't really provide an API for subcommands, but rather indicates to a global instance that it should be subcommand-aware. I don't think that's providing a huge benefit to the user as they can also do this without subcommands by reaching in to opts.arguments (albeit post-parse).

Currently I would just suggest that users dip in to ARGV to support subcommands with the first-argument option only. I'll think a little more on this.

@burke burke closed this Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants