Skip to content

Inconsistencies in ambiguity resolution #19

Open
@gdetrez

Description

@gdetrez

While filing up #18, I found a small inconsistency in the way ambiguities are resolved.
According to docopt.org:

Note, writing --input ARG (opposed to --input=ARG) is ambiguous, meaning it is not possible to tell whether ARG is option's argument or positional argument. In usage patterns this will be interpreted as option with argument only if option's description (covered below) for that option is provided. Otherwise it will be interpreted as separate option and positional argument.

So, if you take the following

Usage:
  test --input ARG

and call it with --input foo you'd expect:

fromList [(LongOption "input",Present),(Argument "ARG",Value "foo")]

but you get

fromList [(LongOption "input",Value "foo")]

Even providing the correct option description doesn't get the intended behavior:

Usage:
  test --input ARG
Options:
  --input
$ test --input foo
fromList [(LongOption "input",Value "foo")]

Disambiguating it the other way gives you something even stranger:

Usage:
  test --input ARG
Options:
  --input ARG
$ test --input foo
fromList [(LongOption "input",Value "foo"),(Argument "ARG",NoValue)]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions