Implement --version switch
authorAlexander Vasarab <alexander@wylark.com>
Wed, 1 Jul 2020 01:07:52 +0000 (18:07 -0700)
committerAlexander Vasarab <alexander@wylark.com>
Wed, 1 Jul 2020 01:07:52 +0000 (18:07 -0700)
infoex-autowx.py

index 78c4d49be685bd86719fa0ccbc7651b681c8bbf3..442376bafcd703ab288cfe3150947c5e3157365b 100755 (executable)
@@ -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)