docopt / docopt.R

Command-line interface description language for R (http://docopt.org)
Other
210 stars 17 forks source link

Vector-valued arguments in docopt? #8

Closed cboettig closed 9 years ago

cboettig commented 9 years ago

Hi Edwin,

First I just wanted to say thanks for this awesome implementation of docopt; it's both elegant and immensely useful. I've been using docopt with @eddelbuettel in some littler scripts and I cannot figure out how to handle the case of an argument that is vector valued; in this case, providing multiple repository URLs for the argument to --repos in that install2.r script Is there a straightforward way to do this in docopt that I'm missing?

Thanks again. & Dirk says hi.

-- Carl

edwindj commented 9 years ago

Hi Carl,

Thanks, let me thank you for your work on rocker: it is great work and really useful for the R community.

Regarding your question:

Thanks for your report (and "Hi Dirk")!

Edwin

edwindj commented 9 years ago

Hi Carl,

It should be fixed in the github repo: could you please check if you have any problems with it? The following example is running fine on my computer.

"
Usage:
    install.r [-r repo]...

Options:
   -r=repo   Repo [default: my_url]
" -> doc

library(docopt)
docopt(doc, '-r repo1 -r repo2')

Best, (and a happy new year!) Edwin

edwindj commented 9 years ago

Small addition: The following is slightly more sound and works too.

"
Usage:
    install.r [-r repo...]

Options:
   -r=repo   Repo [default: my_url]
" -> doc

library(docopt)
docopt(doc, '-r repo1 -r repo2')
cboettig commented 9 years ago

Hi Edwin,

Thanks for the help and the quick fix! I think I'll go with your last suggestion of multiple -r, that seems both very tidy and easy. Happy new year,

Carl

eddelbuettel commented 9 years ago

You guys rock. Happy New Year from (a today very cold) Chicago too!