etherpump/bin/etherpump

45 lines
853 B
Plaintext
Raw 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:
etherpump CMD
2015-11-19 13:14:16 +01:00
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
2015-11-19 13:14:16 +01:00
For more information on each command try:
etherpump CMD --help
2015-11-19 13:14:16 +01:00
"""
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:
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__("etherpump.commands.%s" % cmd, fromlist=["etherdump.commands"])
2015-09-17 18:23:18 +02:00
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)