From 9c49c9949f562d50b128ac9baffaac16dfe663e3 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Tue, 18 May 2021 22:37:04 +0200 Subject: [PATCH] Consolidate and document used environment variables Rename XCA_SPECIAL to XCA_ARGUMENTS, which is less generic. and change %1_OPTIONS to XCA_%1_OPTIONS to prefix all XCA related environment variables with "XCA_". --- doc/xca.1.tail | 31 +++++++++++++++++++++++++++++++ lib/arguments.cpp | 2 +- lib/database_model.cpp | 2 +- lib/main.cpp | 2 +- misc/xca.completion | 2 +- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/doc/xca.1.tail b/doc/xca.1.tail index 250d10db..6cef2648 100644 --- a/doc/xca.1.tail +++ b/doc/xca.1.tail @@ -1,3 +1,34 @@ +.SH ENVIRONMENT VARIABLES +Some more or less useful environment variables are evaluated by xca +.TP +.B XCA_NO_GUI=1 +Do not start the graphical user interface forcefully. Same as +.B --no-gui +argument. If both were not given, XCA tries to be smart and looks +at the other arguments to judge whether to start the GUI or not. +.TP +.B XCA_DEBUG=1 +Enables debugging mode. Same as +.B --verbose +.TP +.B XCA_ABORT_ON_WARNING=1 +Developer option to crash into debugger in case of +a warning-level log message. +Documented for completeness. Not useful for non-developers +.TP +.B XCA_PORTABLE=1 +Force the windows portable mode. +Documented for completeness. Not useful for non-developers +.TP +.B XCA_ARGUMENTS= +Outputs the commandline arguments in man-page nroff, sphinx rst or as +oneline list for command-completion to automatically update the documentation +if new arguments are added. +.TP +.B QPSQL7_OPTIONS QMYSQL3_OPTIONS QODBC3_OPTIONS +Additional connection options for the SQL database drivers as described in +https://doc.qt.io/qt-5/qsqldatabase.html#setConnectOptions like +QPSQL7_OPTIONS=requiressl=1 .SH SEE ALSO A more detailed HTML documentation can be found in the doc directory, diff --git a/lib/arguments.cpp b/lib/arguments.cpp index 21012b21..bec1f05d 100644 --- a/lib/arguments.cpp +++ b/lib/arguments.cpp @@ -142,7 +142,7 @@ QString arguments::rst() { QString s = "..\n" " Automatically created by\n" -" XCA_SPECIAL=rst ./xca > doc/rst/arguments.rst\n\n"; +" XCA_ARGUMENTS=rst ./xca arguments.rst\n\n"; QMap passdoc = getPassDoc(); int space = (maxOptWidth() + 4) * -1; diff --git a/lib/database_model.cpp b/lib/database_model.cpp index f596fb0f..5a09bc42 100644 --- a/lib/database_model.cpp +++ b/lib/database_model.cpp @@ -366,7 +366,7 @@ void database_model::openRemoteDatabase(const QString &connName, db.setUserName(params["user"]); db.setPassword(pass); - QString envvar(db.driverName()+ "_OPTIONS"); + QString envvar(QString("XCA_%1_OPTIONS").arg(db.driverName())); const char *opts = getenv(envvar.toLatin1()); if (opts) db.setConnectOptions(opts); diff --git a/lib/main.cpp b/lib/main.cpp index 37dc2c98..aa3d9d65 100644 --- a/lib/main.cpp +++ b/lib/main.cpp @@ -331,7 +331,7 @@ static void read_cmdline(int argc, char *argv[]) int main(int argc, char *argv[]) { - const char *xca_special = getenv("XCA_SPECIAL"); + const char *xca_special = getenv("XCA_ARGUMENTS"); if (xca_special && *xca_special) { puts(CCHAR(arguments::doc(xca_special))); return 0; diff --git a/misc/xca.completion b/misc/xca.completion index bb6412d6..f84f1605 100644 --- a/misc/xca.completion +++ b/misc/xca.completion @@ -1,5 +1,5 @@ -_XCA_WORDS="$(XCA_SPECIAL=completion xca)" +_XCA_WORDS="$(XCA_ARGUMENTS=completion xca)" _xca() { COMPREPLY=($(compgen -f -W "$_XCA_WORDS" -- "${COMP_WORDS[COMP_CWORD]}")) }