Browse Source

Fake versioning and help output

pull/4/head
Luke Murphy 5 years ago
parent
commit
9268ec1ff7
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 20
      bin/etherpump

20
bin/etherpump

@ -27,18 +27,24 @@ For more information on each command try:
try: try:
cmd = sys.argv[1] cmd = sys.argv[1]
if cmd.startswith("-"): if cmd.startswith("-"):
cmd = "sync" args = sys.argv
args = sys.argv
else: 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: except IndexError:
print (usage) print(usage)
sys.exit(0) sys.exit(0)
try: try:
# http://stackoverflow.com/questions/301134/dynamic-module-import-in-python # http://stackoverflow.com/questions/301134/dynamic-module-import-in-python
cmdmod = __import__("etherpump.commands.%s" % cmd, fromlist=["etherdump.commands"]) cmdmod = __import__("etherpump.commands.%s" % cmd, fromlist=["etherdump.commands"])
cmdmod.main(args) cmdmod.main(args)
except ImportError as e: except ImportError as e:
print ("Error performing command '{0}'\n(python said: {1})\n".format(cmd, e)) print("Error performing command '{0}'\n(python said: {1})\n".format(cmd, e))
print (usage) print(usage)

Loading…
Cancel
Save