-
Notifications
You must be signed in to change notification settings - Fork 17
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
can't make example from docopt.org work #38
Comments
Thanks for reporting, I'll look into it tomorrow! Best |
I think the error you're seeing is because you're using it in a context where the command line args to the R session are not a valid "usage". docopt(doc, "-h")
# or
docopt(doc, c("ship", "new", "Boaty McBoatface")) |
I actually tried to put it to test in real command-line environment. i.e. I have a rscript file (where we have that typical line of |
Ok so I think I somehow get the idea now. We do need to run the actual script in a real terminal to get it to work correctly but that is a little bit implicit in documentation.... (too implicit to actually see it anywhere.... :P ) Firstly, it is right if you run your script from RStudio (for example) you'll have to provide dummy values for docopt to understand you are simulating the real command-line environment and to feed you back with correct simulated output. The same logic applies in terminal experiment as well. The example on the front page is supposed to be run with actual input value for each argument for docopt to understand. i.e. let's call our front-page example file 'test.R' and it has correct permission, to test incorrect usage as suggested, all output on terminal should match the results demonstrated on the front page. |
Newbie here.
Here is example from http://docopt.org/:
Trying to make it work from R:
Getting uninformative error:
The text was updated successfully, but these errors were encountered: