Implement --version flag

This commit is contained in:
Aanand Prasad 2013-12-19 13:06:26 +00:00
commit 9f1d08c54b
2 changed files with 10 additions and 1 deletions

View file

@ -12,6 +12,9 @@ def docopt_full_help(docstring, *args, **kwargs):
class DocoptCommand(object):
def docopt_options(self):
return {'options_first': True}
def sys_dispatch(self):
self.dispatch(sys.argv[1:], None)
@ -22,7 +25,7 @@ class DocoptCommand(object):
handler(command_options)
def parse(self, argv, global_options):
options = docopt_full_help(getdoc(self), argv, options_first=True)
options = docopt_full_help(getdoc(self), argv, **self.docopt_options())
command = options['COMMAND']
if not hasattr(self, command):