mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
By default, overwrite the main file on export, but allow changing default
behavior through the environment variable LYX_FORCE_OVERWRITE. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34946 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
be06af987f
commit
161af56f4e
23
lyx.1in
23
lyx.1in
@ -75,11 +75,13 @@ Note that the order of -e and -x switches matters.
|
|||||||
where fmt is the import format of choice and file.xxx is the file to be imported.
|
where fmt is the import format of choice and file.xxx is the file to be imported.
|
||||||
.TP
|
.TP
|
||||||
\fB \-f [\-\-force\-overwrite]\fP \fIwhat
|
\fB \-f [\-\-force\-overwrite]\fP \fIwhat
|
||||||
where what is is either "\fBall\fR" or "\fBmain\fR".
|
where what is is either "\fBall\fR", "\fBmain\fR" or "\fBnone\fR".
|
||||||
Using "\fBall\fR", all files are overwritten during a batch export, otherwise
|
Specify "\fBall\fR" to allow overwriting all files during a batch export,
|
||||||
only the main file will be. When this switch is followed by anything else other
|
"\fBmain\fR" to allow overwriting the main file only, or "\fBnone\fR"
|
||||||
than "\fBall\fR" or "\fBmain\fR", the behavior is as if "\fBall\fR" was
|
to disallow overwriting any file. When this switch is followed by anything
|
||||||
specified, but what follows is left on the command line for further processing.
|
else other than "\fBall\fR", "\fBmain\fR" or "\fBnone\fR", the behavior is as
|
||||||
|
if "\fBall\fR" was specified, but what follows is left on the command line for
|
||||||
|
further processing.
|
||||||
.TP
|
.TP
|
||||||
.BI -batch
|
.BI -batch
|
||||||
causes LyX to run the given commands without opening a GUI window.
|
causes LyX to run the given commands without opening a GUI window.
|
||||||
@ -124,6 +126,17 @@ The user directory is, in order of precedence:
|
|||||||
.B LYX_LOCALEDIR
|
.B LYX_LOCALEDIR
|
||||||
can be used to tell LyX where to look for the translations of its GUI
|
can be used to tell LyX where to look for the translations of its GUI
|
||||||
strings in other languages.
|
strings in other languages.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B LYX_FORCE_OVERWRITE
|
||||||
|
can be used to change the default behavior when exporting from command
|
||||||
|
line.
|
||||||
|
.PP
|
||||||
|
By default, LyX overwrites the main file when exporting from command
|
||||||
|
line but not the ancillary files. This behavior can be changed by setting
|
||||||
|
this environment variable, which relieves the need of using the \-f switch.
|
||||||
|
Allowed values are either "\fBall\fR", "\fBmain\fR" or "\fBnone\fR", with
|
||||||
|
same meaning as for the \-f switch.
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.nf
|
.nf
|
||||||
.ta \w'\fILIBDIR\fR/lyxrc.in 'u
|
.ta \w'\fILIBDIR\fR/lyxrc.in 'u
|
||||||
|
28
src/LyX.cpp
28
src/LyX.cpp
@ -91,9 +91,11 @@ bool use_gui = true;
|
|||||||
|
|
||||||
|
|
||||||
// Tell what files can be silently overwritten during batch export.
|
// Tell what files can be silently overwritten during batch export.
|
||||||
// Possible values are: NO_FILES, MAIN_FILE, ALL_FILES.
|
// Possible values are: NO_FILES, MAIN_FILE, ALL_FILES, UNSPECIFIED.
|
||||||
|
// Unless specified on command line (through the -f switch) or through the
|
||||||
|
// environment variable LYX_FORCE_OVERWRITE, the default will be MAIN_FILE.
|
||||||
|
|
||||||
OverwriteFiles force_overwrite = NO_FILES;
|
OverwriteFiles force_overwrite = UNSPECIFIED;
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -736,9 +738,20 @@ bool LyX::init()
|
|||||||
if (queryUserLyXDir(package().explicit_user_support()))
|
if (queryUserLyXDir(package().explicit_user_support()))
|
||||||
reconfigureUserLyXDir();
|
reconfigureUserLyXDir();
|
||||||
|
|
||||||
// no need for a splash when there is no GUI
|
|
||||||
if (!use_gui) {
|
if (!use_gui) {
|
||||||
|
// No need for a splash when there is no GUI
|
||||||
first_start = false;
|
first_start = false;
|
||||||
|
// Default is to overwrite the main file during export, unless
|
||||||
|
// the -f switch was specified or LYX_FORCE_OVERWRITE was set
|
||||||
|
if (force_overwrite == UNSPECIFIED) {
|
||||||
|
string const what = getEnv("LYX_FORCE_OVERWRITE");
|
||||||
|
if (what == "all")
|
||||||
|
force_overwrite = ALL_FILES;
|
||||||
|
else if (what == "none")
|
||||||
|
force_overwrite = NO_FILES;
|
||||||
|
else
|
||||||
|
force_overwrite = MAIN_FILE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This one is generated in user_support directory by lib/configure.py.
|
// This one is generated in user_support directory by lib/configure.py.
|
||||||
@ -1012,9 +1025,9 @@ int parse_help(string const &, string const &, string &)
|
|||||||
" where fmt is the import format of choice\n"
|
" where fmt is the import format of choice\n"
|
||||||
" and file.xxx is the file to be imported.\n"
|
" and file.xxx is the file to be imported.\n"
|
||||||
"\t-f [--force-overwrite] what\n"
|
"\t-f [--force-overwrite] what\n"
|
||||||
" where what is either `all' or `main'.\n"
|
" where what is either `all', `main' or `none',\n"
|
||||||
" Using `all', all files are overwritten during\n"
|
" specifying whether all files, main file only, or no files,\n"
|
||||||
" a batch export, otherwise only the main file will be.\n"
|
" respectively, are to be overwritten during a batch export.\n"
|
||||||
" Anything else is equivalent to `all', but is not consumed.\n"
|
" Anything else is equivalent to `all', but is not consumed.\n"
|
||||||
"\t-batch execute commands without launching GUI and exit.\n"
|
"\t-batch execute commands without launching GUI and exit.\n"
|
||||||
"\t-version summarize version and build info\n"
|
"\t-version summarize version and build info\n"
|
||||||
@ -1126,6 +1139,9 @@ int parse_force(string const & arg, string const &, string &)
|
|||||||
} else if (arg == "main") {
|
} else if (arg == "main") {
|
||||||
force_overwrite = MAIN_FILE;
|
force_overwrite = MAIN_FILE;
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (arg == "none") {
|
||||||
|
force_overwrite = NO_FILES;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
force_overwrite = ALL_FILES;
|
force_overwrite = ALL_FILES;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user