The :short-circuit option in argparse does not let the parsing fail, as only the internal usage function sets the var bad to true.
I corrected this in the docstring and also added a step that collects the rest of the arguments when hitting the :short-circuit flag.
This should allow people to implement subcommands more easily using something like :default {:kind :accumulate :short-circuit true} to parse args per subcommand.
Currently, :rest includes the flag that short-circuited, while this does make it easier to implement subcommands with their own arg parsing it might be a bit unexpected for some.
The :short-circuit option in argparse does not let the parsing fail, as only the internal usage function sets the var bad to true. I corrected this in the docstring and also added a step that collects the rest of the arguments when hitting the :short-circuit flag. This should allow people to implement subcommands more easily using something like
:default {:kind :accumulate :short-circuit true}
to parse args per subcommand.Currently,
:rest
includes the flag that short-circuited, while this does make it easier to implement subcommands with their own arg parsing it might be a bit unexpected for some.