Add more single character switches

This commit is contained in:
Veronica Berglyd Olsen
2025-02-04 20:16:47 +01:00
parent a931fe5cfd
commit 706c61c550
+9 -9
View File
@@ -91,7 +91,7 @@ def main(sysArgs: list | None = None) -> GuiMain | None:
nColor = os.environ.get("NO_COLOR") nColor = os.environ.get("NO_COLOR")
# Valid Input Options # Valid Input Options
shortOpt = "hvc" shortOpt = "hvidc"
longOpt = [ longOpt = [
"help", "help",
"version", "version",
@@ -124,9 +124,9 @@ def main(sysArgs: list | None = None) -> GuiMain | None:
"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"
" --info Print additional runtime information.\n" " -i, --info Print additional runtime information.\n"
" --debug Print debug output. Includes --info.\n" " -d, --debug Print debug output. Includes --info.\n"
" --color Add ANSI colors to log output.\n" " -c, --color Add ANSI colors to log output.\n"
" --meminfo Show memory usage information in the status bar.\n" " --meminfo Show memory usage information in the status bar.\n"
" --style= Sets Qt style flag. Defaults to 'Fusion'.\n" " --style= Sets Qt style flag. Defaults to 'Fusion'.\n"
" --config= Alternative config file.\n" " --config= Alternative config file.\n"
@@ -159,22 +159,22 @@ def main(sysArgs: list | None = None) -> GuiMain | None:
elif inOpt in ("-v", "--version"): elif inOpt in ("-v", "--version"):
print("novelWriter Version %s [%s]" % (__version__, __date__)) print("novelWriter Version %s [%s]" % (__version__, __date__))
sys.exit(0) sys.exit(0)
elif inOpt == "--info": elif inOpt in ("-i", "--info"):
logLevel = logging.INFO logLevel = logging.INFO
elif inOpt == "--debug": elif inOpt in ("-d", "--debug"):
CONFIG.isDebug = True CONFIG.isDebug = True
fmtFlags = fmtFlags | 0b10 fmtFlags = fmtFlags | 0b10
logLevel = logging.DEBUG logLevel = logging.DEBUG
elif inOpt == "--color" and not nColor: elif inOpt in ("-c", "--color") and not nColor:
fmtFlags = fmtFlags | 0b01 fmtFlags = fmtFlags | 0b01
elif inOpt == "--meminfo":
CONFIG.memInfo = True
elif inOpt == "--style": elif inOpt == "--style":
qtStyle = inArg qtStyle = inArg
elif inOpt == "--config": elif inOpt == "--config":
confPath = inArg confPath = inArg
elif inOpt == "--data": elif inOpt == "--data":
dataPath = inArg dataPath = inArg
elif inOpt == "--meminfo":
CONFIG.memInfo = True
if fmtFlags & 0b01: if fmtFlags & 0b01:
# This will overwrite the default level names, and also ensure that # This will overwrite the default level names, and also ensure that