Closed ZoomRmc closed 2 years ago
You would need to do let opts = p.parse(@["-n", "2", "A"])
Does that work?
Edit to add: Doing @["-n 2", "A"]
is equivalent to running the program from a shell like this: > myprog '-n 2' A
Yep, sorry for the bad issue. Bitten by trying to apply a broken test before running the actual program to test manually. :D
The part on explicitly listing available value passing syntax still stands:
-x=n
-x n
-x:n
-xn
Output:
Unknown argument(s): B
Changing"-n 2"
to"-n=2"
works as expected.This passes, which is unexpected (and, IMO, broken):
It looks like argparse can't parse a value for an option without
=
. The docs are not clear on the rules, the only mention of allowed format is in the table on the doc page:Which means passing whitespace delimited option values should work.