Skip to content

Commit cc73221

Browse files
committed
Updated to python master/1d4a26b38e16dfba858fced505b296743113f3c6
1 parent c393406 commit cc73221

3 files changed

Lines changed: 250 additions & 204 deletions

File tree

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
> are unlikely to be accepted unless they are themselves direct transliterations
1212
> of bugfixes in the Python version.
1313
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-
1914

2015
Isn't it awesome how `optparse` and `argparse` generate help messages
2116
based on your code?!
@@ -74,7 +69,7 @@ Installation
7469
```javascript
7570
{
7671
"require": {
77-
"docopt/docopt": "0.4.2"
72+
"docopt/docopt": "0.5.0"
7873
}
7974
}
8075
```
@@ -275,17 +270,30 @@ Use the following constructs to specify patterns:
275270
`stdin` is used instead of a file. To support this add "`[-]`" to
276271
you usage patterns. "`-`" act as a normal command.
277272

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']`.
282290

283291

284292
Option descriptions format
285293
-------------------------------------------------------------------------------
286294

287295
**Option descriptions** consist of a list of options that you put below your
288-
ussage patterns.
296+
usage patterns.
289297

290298
It is necessary to list option descriptions in order to specify:
291299

0 commit comments

Comments
 (0)