tweak the version flag output to show more package/system info

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
Brian S. Stephan 2024-04-19 08:08:51 -05:00
parent 2adb1540a1
commit 56eb65dd55
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
2 changed files with 4 additions and 2 deletions

View File

@ -33,7 +33,8 @@ logger = logging.getLogger(__name__)
# parse flags that are common to many tools (e.g. adding paths for finding .proto files)
core_parser = argparse.ArgumentParser(add_help=False)
core_parser.add_argument('-v', '--version', action='version', version=f"%(prog)s {__version__}",
core_parser.add_argument('-v', '--version', action='version',
version=f"gp2040ce-binary-tools {__version__} (Python {sys.version})",
help="show version information and exit")
core_parser.add_argument('-d', '--debug', action='store_true', help="enable debug logging")
core_parser.add_argument('-P', '--proto-files-path', type=pathlib.Path, default=list(), action='append',

View File

@ -30,7 +30,8 @@ def with_pb2s(test, *args, **kwargs):
def test_version_flag():
"""Test that tools report the version."""
result = run(['visualize-config', '-v'], capture_output=True, encoding='utf8')
assert __version__ in result.stdout
assert f'gp2040ce-binary-tools {__version__}' in result.stdout
assert 'Python 3' in result.stdout
def test_help_flag():