|
11 | 11 | > are unlikely to be accepted unless they are themselves direct transliterations |
12 | 12 | > of bugfixes in the Python version. |
13 | 13 |
|
14 | | -> Though all of the 0.4.2 tests pass, there may still be issues as this port is |
15 | | -> relatively new. Please visit the |
16 | | -> [PHP port's issues page](http://github.com/docopt/docopt.php) |
17 | | -> for a list of all current known issues and caveats. |
18 | | -
|
19 | 14 |
|
20 | 15 | Isn't it awesome how `optparse` and `argparse` generate help messages |
21 | 16 | based on your code?! |
@@ -74,7 +69,7 @@ Installation |
74 | 69 | ```javascript |
75 | 70 | { |
76 | 71 | "require": { |
77 | | - "docopt/docopt": "0.4.2" |
| 72 | + "docopt/docopt": "0.5.0" |
78 | 73 | } |
79 | 74 | } |
80 | 75 | ``` |
@@ -275,17 +270,30 @@ Use the following constructs to specify patterns: |
275 | 270 | `stdin` is used instead of a file. To support this add "`[-]`" to |
276 | 271 | you usage patterns. "`-`" act as a normal command. |
277 | 272 |
|
278 | | -If your usage patterns allow to match the same-named argument several times, |
279 | | -parser will put the matched values into a list, e.g. in case the pattern is |
280 | | -`my-program.php FILE FILE` then `args['FILE']` will be a list; in case the |
281 | | -pattern is `my-program.php FILE...` it will also be a list. |
| 273 | +If your pattern allows to match argument-less option (a flag) several times: |
| 274 | + |
| 275 | + Usage: my_program.py [-v | -vv | -vvv] |
| 276 | + |
| 277 | +then number of occurences of the option will be counted. I.e. `args['-v']` |
| 278 | +will be `2` if program was invoked as `my_program -vv`. Same works for |
| 279 | +commands. |
| 280 | + |
| 281 | +If your usage patterns allows to match same-named option with argument |
| 282 | +or positional argument several times, the matched arguments will be |
| 283 | +collected into a list: |
| 284 | + |
| 285 | + Usage: my_program.py <file> <file> --path=<path>... |
| 286 | + |
| 287 | +I.e. invoked with `my_program.py file1 file2 --path=./here --path=./there` |
| 288 | +the returned dict will contain `args['<file>'] == ['file1', 'file2']` and |
| 289 | +`args['--path'] == ['./here', './there']`. |
282 | 290 |
|
283 | 291 |
|
284 | 292 | Option descriptions format |
285 | 293 | ------------------------------------------------------------------------------- |
286 | 294 |
|
287 | 295 | **Option descriptions** consist of a list of options that you put below your |
288 | | -ussage patterns. |
| 296 | +usage patterns. |
289 | 297 |
|
290 | 298 | It is necessary to list option descriptions in order to specify: |
291 | 299 |
|
|
0 commit comments