Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Add example for #16
Browse files Browse the repository at this point in the history
  • Loading branch information
felixSchl committed Apr 17, 2016
1 parent a941c40 commit 2662304
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions testcases.docopt
Original file line number Diff line number Diff line change
Expand Up @@ -1789,3 +1789,46 @@ $ prog --input 10

$ prog --input 10 20
{ "-i": 10, "--input": 10, "<x>": 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]}

0 comments on commit 2662304

Please sign in to comment.