Refactor dispatch of command-line arguments

The new model factors out the logic used to dispatch the data structure parsed by docopt. Now it is unit-tested and some edge cases and missing features were fixed.

Additionally, a wrapper for `itertools.count` was written to use with mock call assertions.