docopt / docopt.hs

A command-line interface description language and parser that will make you smile
http://docopt.org/
MIT License
119 stars 24 forks source link

Stdin [-] doesn't parse correctly. #14

Closed alexchandel closed 8 years ago

alexchandel commented 9 years ago

When I have a usage of the form:

Usage:
  foo bar <baz>...
  foo bar [-]

I would expect EITHER isPresent args (argument "baz") OR isPresent args (command "[-]") (or isPresent args (argument "[-]") or however you're supposed to refer to it) to be true. Not both.

Yet docopt.hs consistently find argument "baz" even when none exists, if [-] is passed.

Also, the README and documentation are extremely vague on how the stdin argument [-] should be checked for.

ryanartecona commented 9 years ago

That [-] in the usage pattern is intended to be matched with command "-". The square brackets mark it as an optional command, but aren't a part of the command name itself.

I think the argument "baz" issue is the same as in #15. The docs should also be clearer on how the [-] and [--] conventions are handled.

Thanks for submitting these issues! @alexchandel

alexchandel commented 9 years ago

@ryanartecona np, docopt is my preferred arg parsing API, it'd be nice to use it in Haskell.