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
+11 -19
View File
@@ -69,10 +69,10 @@ def main(sysArgs):
""" """
# Valid Input Options # Valid Input Options
shortOpt = "hd:Dqtl:v" shortOpt = "hdDqtl:v"
longOpt = [ longOpt = [
"help", "help",
"debug=", "debug",
"verbose", "verbose",
"debuggui", "debuggui",
"quiet", "quiet",
@@ -90,11 +90,11 @@ def main(sysArgs):
"Usage:\n" "Usage:\n"
" -h, --help Print this message.\n" " -h, --help Print this message.\n"
" -v, --version Print program version and exit.\n" " -v, --version Print program version and exit.\n"
" -d, --debug Debug level. Valid options are DEBUG, INFO, WARN or ERROR.\n" " -d, --debug Print debug output.\n"
" --verbose Increase verbosity of debug.\n" " --verbose Increase verbosity of debug output.\n"
" -D, --debuggui Shows additional debug GUI elements.\n" " -D, --debuggui Shows additional debug GUI elements. Includes -d.\n"
" -q, --quiet Disable output to command line. Does not affect log file.\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" " -l, --logfile Specify log file.\n"
" --config Alternative config file.\n" " --config Alternative config file.\n"
" --headless Do not display GUI. Useful for testing scripts.\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__)) print("makeNovel %s Version %s" % (__status__,__version__))
exit() exit()
elif inOpt in ("-d", "--debug"): elif inOpt in ("-d", "--debug"):
if inArg == "ERROR": debugLevel = logging.DEBUG
debugLevel = logging.ERROR debugStr = "{name:>22}:{lineno:<4d} {levelname:8} {message:}"
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"): elif inOpt in ("-l","--logfile"):
logFile = inArg logFile = inArg
toFile = True toFile = True
@@ -158,7 +148,9 @@ def main(sysArgs):
elif inOpt in ("--headless"): elif inOpt in ("--headless"):
showGUI = False showGUI = False
elif inOpt in ("-D","--debuggui"): elif inOpt in ("-D","--debuggui"):
debugGUI = True debugLevel = logging.DEBUG
debugStr = "{name:>22}:{lineno:<4d} {levelname:8} {message:}"
debugGUI = True
# Set GUI options # Set GUI options
CONFIG.showGUI = showGUI CONFIG.showGUI = showGUI