adishavit / argh

Argh! A minimalist argument handler.
BSD 3-Clause "New" or "Revised" License
1.33k stars 93 forks source link

Support '-' args #58

Closed selaselah closed 3 years ago

selaselah commented 3 years ago

in shell, '-' means stdin/stdout and very useful, eg echo hello | cat - world.txt

but argh will ignore it

adishavit commented 3 years ago

I am not aware of this shell feature nor what you mean or what you expect.

How would you expect argh to behave? How does it behave now?

Please provide more details and references.

a4z commented 3 years ago

there is no standard in handling the "-"

cd - goes to the last location, and has nothing to do with stdin/stdout

other program might implement "-" different , depending on what is useful for the program.

I don't know if a single - as argument would work with argh to give it a meaning implemented self, depending on the program I would implement.

selaselah commented 3 years ago

I am not aware of this shell feature nor what you mean or what you expect. How would you expect argh to behave? How does it behave now? Please provide more details and references.

'-' should parse as pos_arg args after '--' parse as pos_arg

This is argh behavior vs python's argparse (same as many shell command) package's: argv argh.flags argh.pos_arg argparse.flags argparse.pos_arg
- - -
- - - - - -
inp - - inp inp -
- out - out - out
-- -b -- b -b
-b -- -- b -b
adishavit commented 3 years ago

This goes against the minimalist and simple spirit of the library. Argh does not care how many dashes you use (except for the case when specifying SINGLE_DASH_ISMULTIFLAG ). 🤷 ¯_(ツ)/¯