mirror of https://github.com/docker/compose.git
Implement --version flag
This commit is contained in:
parent
9e9a20b227
commit
9f1d08c54b
|
@ -12,6 +12,9 @@ def docopt_full_help(docstring, *args, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
class DocoptCommand(object):
|
class DocoptCommand(object):
|
||||||
|
def docopt_options(self):
|
||||||
|
return {'options_first': True}
|
||||||
|
|
||||||
def sys_dispatch(self):
|
def sys_dispatch(self):
|
||||||
self.dispatch(sys.argv[1:], None)
|
self.dispatch(sys.argv[1:], None)
|
||||||
|
|
||||||
|
@ -22,7 +25,7 @@ class DocoptCommand(object):
|
||||||
handler(command_options)
|
handler(command_options)
|
||||||
|
|
||||||
def parse(self, argv, global_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']
|
command = options['COMMAND']
|
||||||
|
|
||||||
if not hasattr(self, command):
|
if not hasattr(self, command):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from inspect import getdoc
|
from inspect import getdoc
|
||||||
|
@ -70,6 +71,11 @@ class TopLevelCommand(Command):
|
||||||
stop Stop services
|
stop Stop services
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
def docopt_options(self):
|
||||||
|
options = super(TopLevelCommand, self).docopt_options()
|
||||||
|
options['version'] = "plum %s" % __version__
|
||||||
|
return options
|
||||||
|
|
||||||
def ps(self, options):
|
def ps(self, options):
|
||||||
"""
|
"""
|
||||||
List services and containers.
|
List services and containers.
|
||||||
|
|
Loading…
Reference in New Issue