docopt.R
docopt.R copied to clipboard
help message docstring cut off
I have a long message docstring. If I use the -h
parameter, the full message is shown. However, for any errors, it gets cut off. This did not happen with docopt 0.6.1, but it happens with 0.7.1.
When it's working, I get:
Naval Fate.
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
Usage:
naval_fate ship new <name>...
naval_fate ship <name> move <x> <y> [--speed=<kn>]
naval_fate ship shoot <x> <y>
naval_fate mine (set|remove) <x> <y> [--moored|--drifting]
naval_fate -h | --help
naval_fate --version
Options:
-h --help Show this screen.
--version Show version.
--speed=<kn> Speed in knots [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.
When it's cut off, I get:
Error:
Naval Fate.
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lots of text lots of text
lots of text lots of text lots of text lots of text lots of text lot
Execution halted
I am seeing the same bug where r-docopt v0.7.1
tries to export the full help string when processing an argument error and clips the help text.
$ conda list r-docopt
# packages in environment at /home/pr/.Miniconda3/envs/snikt:
#
# Name Version Build Channel
r-docopt 0.7.1 r41hc72bb7e_0 conda-forge
$ ./test.R
Error:
Naval Fate. With more text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
A lot of text. A lot of text. A lot of text.
Usage:
naval_fate.R ship new <name>...
naval_fate.R ship <n
Execution halted
I also noticed that inserting a large number of lines with only a few chars per line does not reproduce the problem. The number of lines introduced in the following example are same (20 lines) as the previously injected text.
$ ./test.R
Error:
Naval Fate. With more text.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Usage:
naval_fate.R ship new <name>...
naval_fate.R ship <name> move <x> <y> [--speed=<kn>]
naval_fate.R ship shoot <x> <y>
naval_fate.R mine (set|remove) <x> <y> [--moored | --drifting]
naval_fate.R (-h | --help)
naval_fate.R --version
Options:
-h --help Show this screen.
--version Show version.
--speed=<kn> Speed in knots [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.
Execution halted
r-docopt v0.6.1
works as intended - showing only the usage syntax on argument error. I think this is the expected behavior according to the Docopt specifications. This way, it doesn't show any options which is fine because --help
can be used to check full help. This also doesn't clip the usage.
$ conda list r-docopt
# packages in environment at /home/pr/.Miniconda3/envs/envTmp:
#
# Name Version Build Channel
r-docopt 0.6.1 r36h6115d3f_0
$ ./test.R
Error:
usage: naval_fate.R ship new <name>...
usage: naval_fate.R ship <name> move <x> <y> [--speed=<kn>]
usage: naval_fate.R ship shoot <x> <y>
usage: naval_fate.R mine (set|remove) <x> <y> [--moored | --drifting]
usage: naval_fate.R (-h | --help)
usage: naval_fate.R --version
Execution halted