etherpump/bin/etherdump

46 lines
865 B
Plaintext
Raw Permalink Normal View History

2018-01-12 14:42:55 +01:00
#!/usr/bin/env python3
2018-01-12 14:42:55 +01:00
from __future__ import print_function
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:
2016-01-15 14:08:09 +01:00
pull
index
dumpcsv
2015-11-19 13:14:16 +01:00
gettext
gethtml
creatediffhtml
list
listauthors
revisionscount
showmeta
2016-01-15 14:08:09 +01:00
html5tidy
addtext
2015-11-19 13:14:16 +01:00
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("-"):
cmd = "pull"
2015-09-17 18:23:18 +02:00
args = sys.argv
else:
args = sys.argv[2:]
except IndexError:
2018-01-12 14:42:55 +01:00
print (usage)
2015-11-19 13:14:16 +01:00
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)
2018-01-12 14:42:55 +01:00
except ImportError as e:
print ("Error performing command '{0}'\n(python said: {1})\n".format(cmd, e))
print (usage)