Open
Description
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).
Activity
shabbybanks commentedon Jul 14, 2017
My proposed fix would be to optionally allow compatibility with Python (and
docopt
'standard' as of 0.6) whereUsage:
starts the usage stanza andOptions:
starts the option stanza. Allow the old standard for backwards compatibility, but move towards deprecating it: a mild warning in 2 releases, a stronger warning in 4, and deprecated in 6, or what have you.See also docopt docs.
edwindj commentedon Jul 18, 2017
Thanks for the suggestion: I will look into it at the end of this week.
Best,
Edwin
dweemx commentedon Dec 20, 2018
Any update on this feature?
Got a work aroung with this:
benscarlson commentedon Jan 26, 2024
It would be very nice to be able to wrap long usage strings. This does not appear to be possible as of version 0.7.1