argh icon indicating copy to clipboard operation
argh copied to clipboard

Distinguish between `x` and `-- x`

Open jyn514 opened this issue 4 years ago • 2 comments

https://github.com/google/argh/pull/60 marks all options following -- as positional arguments, but there's no way to tell the difference between arguments before and after the dashes.

My use case is that I have a cargo wrapper, and I want to pass all arguments after -- verbatim to cargo, but parse arguments before -- differently.

jyn514 avatar Jan 19 '21 06:01 jyn514

One related nit, which seems too small to file its own bug:

The help looks like this, with argh 0.1.7

Usage: mutants [<cargo_test_args...>] [--all-logs] [-v] [--check] [--diff] [-d <dir>] [--json] [--list] [--no-times] [--shuffle] [-t <timeout>] [-V]

but it's a little confusing to put the arguments first, before the options.

If Argh had a first-class concept of "stuff after --" then it could show it as such in the help.

sourcefrog avatar Feb 10 '22 15:02 sourcefrog

@jyn514 agreed, I think there should be a way to distinguish them, the common meaning of -- to be "terminate normal argument parsing and handle specially" should not apply to arguments preceding --

raggi avatar Feb 10 '22 19:02 raggi