docopt/docopt — pull request #128 by joeyespo (2013-07-20 17:08:45+00:00)
Title: Add access to default values

This change adds a `defaults` attribute to `Dict` so you can have access to the initial default values, e.g. `args.defaults['--myarg']`.

This is particularly useful when showing a warning for an invalid argument and you want to use the argument's default value without duplicating the value in code. DRY.

For example,
```python
from docopt import docopt

doc = """usage: example.py [options]

options:
--max= The max number [default: 10].
"""
args = docopt(doc)
try:
m = int(args['--max'])
except ValueError:
print "Warning: Argument 'max' must be an integer, got", repr(args['--max'])
m = int(args.defaults['--max'])

print m
```