From 9268ec1ff7ae69b71fee458741d95147a98bb667 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Wed, 25 Sep 2019 19:07:34 +0200 Subject: [PATCH] Fake versioning and help output --- bin/etherpump | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/etherpump b/bin/etherpump index aee8c00..3cf1e76 100755 --- a/bin/etherpump +++ b/bin/etherpump @@ -27,18 +27,24 @@ For more information on each command try: try: cmd = sys.argv[1] if cmd.startswith("-"): - cmd = "sync" - args = sys.argv + args = sys.argv else: - args = sys.argv[2:] + args = sys.argv[2:] + + if any(arg in args for arg in ['--help', '-h']): + print(usage) + sys.exit(0) + elif any(arg in args for arg in ['--version', '-v']): + print('etherpump 0.0.1') + sys.exit(0) + except IndexError: - print (usage) + print(usage) sys.exit(0) try: # http://stackoverflow.com/questions/301134/dynamic-module-import-in-python cmdmod = __import__("etherpump.commands.%s" % cmd, fromlist=["etherdump.commands"]) cmdmod.main(args) except ImportError as e: - print ("Error performing command '{0}'\n(python said: {1})\n".format(cmd, e)) - print (usage) - + print("Error performing command '{0}'\n(python said: {1})\n".format(cmd, e)) + print(usage)