aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaseer Ahmed <taseer94@gmail.com>2017-01-23 18:41:58 +0500
committerTaseer Ahmed <taseer94@gmail.com>2017-01-23 19:43:14 +0500
commitc8fa86c68ca83347037a418cd3eee45a6d060b59 (patch)
treebff64e1c1d0fa6a1d51c0d2bb34f683176213aea
parent3a08c5442a70dec7f628b7e9b11a9a9384767918 (diff)
Click's built in support for version option
Change-Id: I62ffde066fe2fcb5be7af9a29686a7d380353670 Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
-rw-r--r--qtip/cli/entry.py9
-rw-r--r--tests/unit/cli/test_options.py2
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'])