From 356c4a2e8d59a7d3f9e07e92d3bd3f8f6db90f56 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 20 May 2022 08:27:09 -0300 Subject: [PATCH] Added --version command line option Fixes #300 --- InteractiveHtmlBom/core/config.py | 5 +++-- InteractiveHtmlBom/generate_interactive_bom.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/InteractiveHtmlBom/core/config.py b/InteractiveHtmlBom/core/config.py index 69c7e942..888bbc30 100644 --- a/InteractiveHtmlBom/core/config.py +++ b/InteractiveHtmlBom/core/config.py @@ -304,11 +304,12 @@ def safe_set_checked_strings(clb, strings): dlg.finish_init() @classmethod - def add_options(cls, parser): - # type: (argparse.ArgumentParser) -> None + def add_options(cls, parser, version): + # type: (argparse.ArgumentParser, str) -> None parser.add_argument('--show-dialog', action='store_true', help='Shows config dialog. All other flags ' 'will be ignored.') + parser.add_argument('--version', action='version', version=version) # Html parser.add_argument('--dark-mode', help='Default to dark mode.', action='store_true') diff --git a/InteractiveHtmlBom/generate_interactive_bom.py b/InteractiveHtmlBom/generate_interactive_bom.py index 6c9c1411..465aeec3 100755 --- a/InteractiveHtmlBom/generate_interactive_bom.py +++ b/InteractiveHtmlBom/generate_interactive_bom.py @@ -41,7 +41,7 @@ def to_utf(s): type=lambda s: to_utf(s), help="KiCad PCB file") - Config.add_options(parser) + Config.add_options(parser, version) args = parser.parse_args() logger = ibom.Logger(cli=True)