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_".
This commit is contained in:
Christian Hohnstaedt 2021-05-18 22:37:04 +02:00 committed by Christian Hohnstädt
parent 487f5e2046
commit 9c49c9949f
5 changed files with 35 additions and 4 deletions

View File

@ -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=<man|rst|completion>
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,

View File

@ -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<QString, QString> passdoc = getPassDoc();
int space = (maxOptWidth() + 4) * -1;

View File

@ -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);

View File

@ -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;

View File

@ -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]}"))
}