docopt / docopt.R

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

oddly-formatted usage message #7

Closed rgrannell1 closed 9 years ago

rgrannell1 commented 9 years ago

A file with the following interface

docs <- list()
"
Usage:

    build profile [--previous=<num>] [--time=<time>]
    build redocument
" -> docs $ master

called with

Rscript myfile.R

Raises a usage error, as no arguments were provided to the interface. This is fine, but the output is hard to read as it is presented on one line:

Error in docopt(docs$master) : 
  usage: build profile [--previous=<num>] [--time=<time>]usage: build redocument
Calls: main -> docopt
Execution halted

This example is not too bad, but my actual use case had ~10 different usage sections and was pretty difficult to read. Could you add new-line delimiters between each usage section, so the user can more easily see the correct interface?

Error in docopt(docs$master) : 
  usage: build profile [--previous=<num>] [--time=<time>]
  usage: build redocument
Calls: main -> docopt
Execution halted

I didn't find the code responsible for this behaviour, but I imagine it is within printable_usage.

edwindj commented 9 years ago

Thanks for reporting! Should be fixed in latest version (of github)