added help messages
This commit is contained in:
parent
d549f73a43
commit
c956acbd4f
@ -7,6 +7,8 @@ from os import listdir, mkdir
|
|||||||
from os.path import isfile, exists
|
from os.path import isfile, exists
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
|
import sys, traceback
|
||||||
|
|
||||||
#------------------------------------------------+
|
#------------------------------------------------+
|
||||||
# get_list_from_server_txt
|
# get_list_from_server_txt
|
||||||
#------------------------------------------------+
|
#------------------------------------------------+
|
||||||
@ -218,17 +220,26 @@ def duplicatestest(d, s):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
ap.add_argument('db')
|
ap.add_argument('dest',
|
||||||
ap.add_argument('src')
|
help="destination, either an sqlite3 database or query file")
|
||||||
ap.add_argument('-t', '--test', action='store_true')
|
ap.add_argument('src',
|
||||||
ap.add_argument('-q', '--sql', action='store_true')
|
help="source, should be data generated by a Xonotic server")
|
||||||
|
ap.add_argument('-t', '--test',
|
||||||
|
action='store_true',
|
||||||
|
help="test database for duplicates")
|
||||||
|
ap.add_argument('-q', '--query',
|
||||||
|
action='store_true',
|
||||||
|
help="write query file (as opposed to executing / inserting rows into database)")
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
log_file = init_logging()
|
log_file = init_logging()
|
||||||
print("Writing log to ", log_file)
|
print("Writing log to ", log_file)
|
||||||
if args.test:
|
if args.test:
|
||||||
duplicatestest(args.db, args.src)
|
duplicatestest(args.db, args.src)
|
||||||
if args.sql:
|
if args.query:
|
||||||
f(args.db, args.src)
|
try:
|
||||||
|
f(args.dest, args.src)
|
||||||
|
except FileNotFoundError:
|
||||||
|
traceback.print_exc()
|
||||||
|
print("\t Exiting - no file to work with.", file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
i(args.db, args.src)
|
i(args.dest, args.src)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user