DanCardin / cappa

Declarative CLI argument parser
Apache License 2.0
135 stars 8 forks source link

arguments starting with `--` #182

Closed wresch closed 1 week ago

wresch commented 1 week ago

love the library!

I'm writing a tool where one subcommand wraps an external tool. It intercepts (parses and validates) some of the tool's arguments but there are many more and i am looking for a way to pass through any unparsed arguments to the tool. In other words i would like to collect any unparsed arguments into a list[str]. Is there a way to do this? -- did not seem to stop command line argument parsing as it does for many command line tools.

I suppose i could implement the behavior with -- by modifying sys.argv before handing off to cappa?

DanCardin commented 1 week ago

"double dash" handling exists at least, https://github.com/DanCardin/cappa/blob/main/tests/parser/test_double_dash.py, although it's certainly not the most tested aspect of the library.

If the above doesn't immediately reveal what's wrong, any chance you have a minimal repro of what you have that's not behaving as expected?

wresch commented 1 week ago

hm. i though it tried to implement this analogously to the test you pointed out and it did not work when multiple additional options were passed. But i just redid it and it does indeed work exactly as expected. Apologies for not testing more before opening an issue.