Some tweaks to command line options.

This commit is contained in:
Veronica K. B. Olsen
2018-12-21 15:55:43 +01:00
parent e3af43725a
commit 54597b07e9
+8 -16
View File
@@ -69,10 +69,10 @@ def main(sysArgs):
"""
# Valid Input Options
shortOpt = "hd:Dqtl:v"
shortOpt = "hdDqtl:v"
longOpt = [
"help",
"debug=",
"debug",
"verbose",
"debuggui",
"quiet",
@@ -90,11 +90,11 @@ def main(sysArgs):
"Usage:\n"
" -h, --help Print this message.\n"
" -v, --version Print program version and exit.\n"
" -d, --debug Debug level. Valid options are DEBUG, INFO, WARN or ERROR.\n"
" --verbose Increase verbosity of debug.\n"
" -D, --debuggui Shows additional debug GUI elements.\n"
" -d, --debug Print debug output.\n"
" --verbose Increase verbosity of debug output.\n"
" -D, --debuggui Shows additional debug GUI elements. Includes -d.\n"
" -q, --quiet Disable output to command line. Does not affect log file.\n"
" -t, --time Shows time stamp in logging output. Adds milliseconds for verbose.\n"
" -t, --time Shows time stamp in logging output. Adds milliseconds when --verbose.\n"
" -l, --logfile Specify log file.\n"
" --config Alternative config file.\n"
" --headless Do not display GUI. Useful for testing scripts.\n"
@@ -131,18 +131,8 @@ def main(sysArgs):
print("makeNovel %s Version %s" % (__status__,__version__))
exit()
elif inOpt in ("-d", "--debug"):
if inArg == "ERROR":
debugLevel = logging.ERROR
elif inArg == "WARN":
debugLevel = logging.WARNING
elif inArg == "INFO":
debugLevel = logging.INFO
elif inArg == "DEBUG":
debugLevel = logging.DEBUG
debugStr = "{name:>22}:{lineno:<4d} {levelname:8} {message:}"
else:
print("Invalid debug level")
exit(2)
elif inOpt in ("-l","--logfile"):
logFile = inArg
toFile = True
@@ -158,6 +148,8 @@ def main(sysArgs):
elif inOpt in ("--headless"):
showGUI = False
elif inOpt in ("-D","--debuggui"):
debugLevel = logging.DEBUG
debugStr = "{name:>22}:{lineno:<4d} {levelname:8} {message:}"
debugGUI = True
# Set GUI options