etherpump/bin/etherdump

42 lines
782 B
Plaintext
Raw Normal View History

#!/usr/bin/env python
2015-09-17 18:23:18 +02:00
import sys
2015-11-19 13:14:16 +01:00
usage = """Usage:
etherdump CMD
where CMD could be:
sync
gettext
gethtml
creatediffhtml
dumpcsv
list
listauthors
revisionscount
showmeta
For more information on each command try:
etherdump CMD --help
"""
2015-09-17 18:23:18 +02:00
try:
cmd = sys.argv[1]
if cmd.startswith("-"):
2015-11-19 12:52:35 +01:00
cmd = "sync"
2015-09-17 18:23:18 +02:00
args = sys.argv
else:
args = sys.argv[2:]
except IndexError:
2015-11-19 13:14:16 +01:00
print usage
sys.exit(0)
2015-09-17 18:23:18 +02:00
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:
2015-11-19 13:14:16 +01:00
print "Error performing command '{0}'\n(python said: {1})\n".format(cmd, e)
print usage