RazrFalcon/pico-args

Consider all arguments after "--" free arguments

dutt opened this issue · 3 comments

dutt commented

I recently rewrote the argument parsing for cargo-cupply-chain and one thing I had to work around was the forwarding of arguments. In this case everything after "--" isn't matched by the program itself but forwarded to another program, which worked fine for e.g. "-- foo bar" but it rejected "-- foo --bar" because it was an unused argument.

Ideally everything after " -- " should be considered a free argument.

Example:
"/bin/foo --bar --moo=5 -- --lurg" would match bar and moo, but lurg would be among the free arguments.

  1. #25
  2. #29

Long story short, pico-args will become even simpler soon. And all of this logic must be implemented by the caller and not the library, because there are just too many edge-cases of such a small library.

dutt commented

Ah, fair enough.

Bu the way, this is how you suppose to handle --.