From: Alexander Vasarab Date: Wed, 1 Jul 2020 01:07:52 +0000 (-0700) Subject: Implement --version switch X-Git-Tag: v2.0.0^2~4 X-Git-Url: https://wylark.com/src/infoex-autowx.git/commitdiff_plain/56ad0a141fb31c3292f95c13863df79bf2435205 Implement --version switch --- diff --git a/infoex-autowx.py b/infoex-autowx.py index 78c4d49..442376b 100755 --- a/infoex-autowx.py +++ b/infoex-autowx.py @@ -42,6 +42,8 @@ import zeep import zeep.cache import zeep.transports +__version__ = '2.0.0' + log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) @@ -69,10 +71,20 @@ parser.add_option("--dry-run", default=False, help="fetch data but don't upload to InfoEx") +parser.add_option("--version", + action="store_true", + dest="show_version", + default=False, + help="show program version and exit") + (options, args) = parser.parse_args() config = configparser.ConfigParser(allow_no_value=False) +if options.show_version: + print("%s - %s" % (os.path.basename(__file__), __version__)) + sys.exit(0) + if not options.config: print("Please specify a configuration file via --config.") sys.exit(1)