slop icon indicating copy to clipboard operation
slop copied to clipboard

Parse incrementally, enabling subcommands

Open burke opened this issue 1 year ago • 1 comments

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

burke avatar Nov 14 '23 18:11 burke

@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.

leejarvis avatar Nov 27 '23 18:11 leejarvis