Search code examples
docopt

Use parameter mutliple time but with limit in docopt


I want to format my command usage with docopt.

I found out that

<parameter>...

means that you can write a parameter multiple time. My problem is, that I have an argument that you can repeat multiple times but it has a limit. I don't want to write

<parameter> [<parameter> <parameter> <parameter> <parameter> <parameter> <parameter>]

with the correct count of the

<parameter>

tag. Is there a shorter way to specify that you can use the parameter mutliple times but the maximum is 15 times?


Solution

  • Short answer: No, you can't specify a maximum number of occurrences of a pattern in docopt. You can only specify a minimum. You will have to deal with that afterwards (or write X time).