docopt/docopt — pull request #32 by mkomitee (2012-06-22 21:13:32+00:00)
Title: Support for counted short and long options, a-la ssh -vvv?

This addresses https://github.com/docopt/docopt/issues/30. This allows us to support things like rsync, ssh, and pythons own ability to supply multiple -v options to increase verbosity.

It breaks no tests, and adds one test to explicitly test this new behavior.

It's not an insignificant change. Every (boolean) option that would previously return true/false will return the number of times the option was used, and 0 if it was never used. This breaks no tests because 0 is considered falsey while >1 is considered truthy.

If users test like this:

if opts['verbose']:
pass

They'll be fine. If they explicitly test like this:

if opts['verbose'] is True:
pass

They'll run into issues, but it's my understanding that in general that's not recommended.

As such, in addition to this code change, we probably ought to update the documentation accordingly.