The correct answer would be to use an ellipsis ...
From the docopt documentation
... (ellipsis) one or more elements. To specify that arbitrary number of repeating elements could be accepted, use ellipsis (...), e.g. my_program.py FILE ...
means one or more FILE-s are accepted. If you want to accept zero or more elements, use brackets, e.g.: my_program.py [FILE ...]
. Ellipsis works as a unary operator on the expression to the left.
Using the online parser you can see the output.
Given a docopt of
Naval Fate.
Usage:
naval_fate.py ship new <name>...
naval_fate.py -h | --help
naval_fate.py --version
Options:
-h --help Show this screen.
--version Show version.
An input of ship new 1 2 3 4
will give you the following parsed information
{
"--help": false,
"--version": false,
"<name>": [
"1",
"2",
"3",
"4"
],
"new": true,
"ship": true
}