Correctly handle subcommand help
etherdump --help and etherdump CMD --help should work.
This commit is contained in:
parent
0f3edc0970
commit
bc3f0bb703
@ -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__(
|
||||
|
Loading…
Reference in New Issue
Block a user