diff options
author | zhihui wu <wu.zhihui1@zte.com.cn> | 2017-01-25 01:42:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-01-25 01:42:20 +0000 |
commit | 3d4a579e25540343bc42f4cc407e298fb08ae9c5 (patch) | |
tree | 6d31c2d901e53cb572eb2ab9138a7ebaabb56d3e | |
parent | 334985a8118c61c7f3fe775b0ac6733c33fd1f06 (diff) | |
parent | c8fa86c68ca83347037a418cd3eee45a6d060b59 (diff) |
Merge "Click's built in support for version option"
-rw-r--r-- | qtip/cli/entry.py | 9 | ||||
-rw-r--r-- | tests/unit/cli/test_options.py | 2 |
2 files changed, 3 insertions, 8 deletions
diff --git a/qtip/cli/entry.py b/qtip/cli/entry.py index 0ecb06cd..9f51f25e 100644 --- a/qtip/cli/entry.py +++ b/qtip/cli/entry.py @@ -22,7 +22,6 @@ class Context(object): def __init__(self): self.verbose = False self.debug = False - self.version = 'qtip-1.0.0' def log(self, msg, *args): ''' Log message to stderr ''' @@ -32,10 +31,6 @@ class Context(object): ''' Log message to stderr when verbose ''' pass - def version(self): - ''' Display programs version ''' - pass - def debug(self, msg, *args): ''' Log message to debug ''' pass @@ -72,7 +67,7 @@ class QtipCli(click.MultiCommand): invoke_without_command=True) @click.option('-v', '--verbose', is_flag=True, help='Enable verbose mode.') @click.option('-d', '--debug', is_flag=True, help='Enable debug mode.') -@click.option('--version', is_flag=True, help='Shows program current version.') +@click.version_option('dev') @pass_context -def cli(ctx, verbose, version, debug): +def cli(ctx, verbose, debug): pass diff --git a/tests/unit/cli/test_options.py b/tests/unit/cli/test_options.py index 5129b5cc..f9472814 100644 --- a/tests/unit/cli/test_options.py +++ b/tests/unit/cli/test_options.py @@ -25,7 +25,7 @@ class TestClass(object): def test_version(self, runner): result = runner.invoke(cli, ['--version']) - assert '' in result.output + assert 'dev' in result.output def test_debug(self, runner): result = runner.invoke(cli, ['-d']) |