#345 Add --version option to waiverdb-cli
Merged a year ago by gnaponie. Opened a year ago by lholecek.
lholecek/waiverdb waiver-cli-version-option  into  master

Add --version option to waiverdb-cli
Lukas Holecek • a year ago  
file modified
+9
@@ -3,6 +3,7 @@ 

  import json

  from mock import Mock, patch

  from click.testing import CliRunner

+ from waiverdb import __version__

  from waiverdb.cli import cli as waiverdb_cli

  from waiverdb.cli import guess_product_version

  
@@ -490,3 +491,11 @@ 

          assert result.output == ('Created waiver 15 for result with subject type '

                                   'some-kind-of-magic, identifier setup-2.8.71-7.el7_4 and '

                                   'testcase test.testcase\n')

+ 

+ 

+ def test_waiver_cli_version():

+     runner = CliRunner()

+     args = ['--version']

+     result = runner.invoke(waiverdb_cli, args)

+     assert result.output == f'cli, version {__version__}\n'

+     assert result.exit_code == 0

file modified
+3
@@ -9,6 +9,8 @@ 

  import re

  from xmlrpc import client

  

+ from waiverdb import __version__

+ 

  requests_session = requests.Session()

  

  
@@ -116,6 +118,7 @@ 

  

  

  @click.command(context_settings={'help_option_names': ['-h', '--help']})

+ @click.version_option(version=__version__)

  @click.option('--config-file', '-C', default='/etc/waiverdb/client.conf',

                type=click.Path(exists=True),

                help='Specify a config file to use')

rebased onto b3ac513

a year ago

Thanks!
Looks good +1 \o/

Pull-Request has been merged by gnaponie

a year ago