Skip to content

Linewrap usage line? #29

@shabbybanks

Description

@shabbybanks

It is often natural to split up the Usage line based on length when there are multiple options, but this is apparently not possible? The following MWE:

library(docopt)
doc <- "Usage: example.r [-a <ABCEDARIAN>] [-b <BOTHER>] [-t <TOOLONG>] [-q <QUIT_ALREADY>] \
 [-O <OOOPS>]
-a ABCEDARIAN               just an example. [default: abcde]
-b BOTHER                   just an example. [default: bother]
-t TOOLONG                  just an example. [default: 1234]
-q QUIT_ALREADY             just an example. [default: noquit]
-O OOOPS                    just an example. [default: ooops]
"
opt <- docopt(doc,args='-O nofooz')

yields the error

Error:
 usage: example.r [-a <ABCEDARIAN>] [-b <BOTHER>] [-t <TOOLONG>] [-q <QUIT_ALREADY>]

I have tried dropping the backslash, doubling the backslash, adding another Usage: prefix (which causes a different error about multiple Usage: lines) and so on.

sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.9 (Santiago)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] docopt_0.4.5   fortunes_1.5-4 drat_0.1.2

loaded via a namespace (and not attached):
[1] magrittr_1.5  tools_3.2.2   stringi_1.1.5 stringr_1.2.0

(see also docopt/docopt#130 , which was of no help).

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