etherpump/bin/etherdump
2015-11-19 12:52:35 +01:00

23 lines
505 B
Python
Executable File

#!/usr/bin/env python
import sys
try:
cmd = sys.argv[1]
if cmd.startswith("-"):
cmd = "sync"
args = sys.argv
else:
args = sys.argv[2:]
except IndexError:
cmd = "sync"
args = sys.argv[1:]
try:
# http://stackoverflow.com/questions/301134/dynamic-module-import-in-python
cmdmod = __import__("etherdump.commands.%s" % cmd, fromlist=["etherdump.commands"])
cmdmod.main(args)
except ImportError, e:
print "Command '{0}' not available ({1})".format(cmd, e)