From bc3f0bb7035f3645371b4002ccbb1b05d45824b1 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sat, 28 Sep 2019 00:02:17 +0200 Subject: [PATCH] Correctly handle subcommand help etherdump --help and etherdump CMD --help should work. --- bin/etherpump | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/etherpump b/bin/etherpump index 7e9c608..93e8f41 100755 --- a/bin/etherpump +++ b/bin/etherpump @@ -52,16 +52,18 @@ try: else: 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 {}'.format(__VERSION__)) - sys.exit(0) + if len(sys.argv) < 3: + 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 {}'.format(__VERSION__)) + sys.exit(0) except IndexError: print(usage) sys.exit(0) + try: # http://stackoverflow.com/questions/301134/dynamic-module-import-in-python cmdmod = __import__(