From 26623043f3cd195888eb8cc8971fa0e09f1f04ec Mon Sep 17 00:00:00 2001 From: Felix Schlitter Date: Mon, 18 Apr 2016 07:14:21 +1200 Subject: [PATCH] Add example for #16 --- testcases.docopt | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/testcases.docopt b/testcases.docopt index 254213ff..804c04f3 100644 --- a/testcases.docopt +++ b/testcases.docopt @@ -1789,3 +1789,46 @@ $ prog --input 10 $ prog --input 10 20 { "-i": 10, "--input": 10, "": 20, "X": 20 } + +# +# Repeating parameterised options +# Example for issue #16 +# + +r""" +Usage: + foobar [-f X ... | --foo X ...] +Options: + -f X, --foo X bar +""" + +$ prog -f 1 -f 2 -f 3 -f 4 -f 5 -f 6 +{"--foo": [1, 2, 3, 4, 5, 6], + "-f": [1, 2, 3, 4, 5, 6]} + +$ prog -f 1,2,3,4,5,6 +{"--foo": [1, 2, 3, 4, 5, 6], + "-f": [1, 2, 3, 4, 5, 6]} + +$ prog -f 1,2,3 --foo 4,5,6 +{"--foo": [1, 2, 3, 4, 5, 6], + "-f": [1, 2, 3, 4, 5, 6]} + +r""" +Usage: + foobar [-f X ...] [--foo X ...] +Options: + -f X, --foo X bar. +""" + +$ prog -f 1 -f 2 -f 3 -f 4 -f 5 -f 6 +{"--foo": [1, 2, 3, 4, 5, 6], + "-f": [1, 2, 3, 4, 5, 6]} + +$ prog -f 1,2,3,4,5,6 +{"--foo": [1, 2, 3, 4, 5, 6], + "-f": [1, 2, 3, 4, 5, 6]} + +$ prog -f 1,2,3 --foo 4,5,6 +{"--foo": [1, 2, 3, 4, 5, 6], + "-f": [1, 2, 3, 4, 5, 6]}