Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing options are either NULL or list() depending on "Options:" section #21

Open
mmuurr opened this issue Aug 5, 2016 · 0 comments
Open

Comments

@mmuurr
Copy link

mmuurr commented Aug 5, 2016

Here are 4 docopt docs, and an option-less call results in the same 4 outputs for all cases in the reference implementation... but in the R package one of the docs results in list() instead of NULL.

Case 1 :

doc <- "
prog
Usage:
  prog [(--foo=X --bar=X)]
"
str(docopt::docopt(doc, "", strict = TRUE))
 List of 2
  $ --foo: NULL
  $ --bar: NULL
  - attr(*, "class")= chr [1:2] "docopt" "list"

Case 2:

doc <- "
prog
Usage:
  prog [(--foo=X --bar=X)]
Options:
  --foo=X  some description
  --bar=X  some other description
"
str(docopt::docopt(doc, "", strict = TRUE))
 List of 2
  $ --foo: NULL
  $ --bar: NULL
  - attr(*, "class")= chr [1:2] "docopt" "list"

Case 3:

doc <- "
prog
Usage:
  prog [options] [(--foo=X --bar=X)]
"
str(docopt::docopt(doc, "", strict = TRUE))
 List of 2
  $ --foo: list()
  $ --bar: list()
  - attr(*, "class")= chr [1:2] "docopt" "list"

Case 4:

doc <- "
prog
Usage:
  prog [options] [(--foo=X --bar=X)]
Options:
  --foo=X  some description
  --bar=X  some other description
"
str(docopt::docopt(doc, "", strict = TRUE))
 List of 2
  $ --foo: NULL
  $ --bar: NULL
  - attr(*, "class")= chr [1:2] "docopt" "list"

Cases 1, 2, and 4 give --foo and --bar as NULL.
Case 3 give --foo and --bar as list().
The Python reference implementation gives null for all four cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant