mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Exit with error if no filename given to -e switch
Before, 'lyx -e pdf2' would give no error and would exit with 0. A use case is if a user has in a bash script the following command: lyx -e pdf2 "${mylxyfile}" || exit 1 where 'lyx' is mispelled as 'lxy' and thus yields an empty string. If LyX does not exit with an error, the script continues where the user probably intends for it to stop.
This commit is contained in:
parent
cc138f6e68
commit
6df4a7bb40
@ -1119,13 +1119,17 @@ int parse_export_to(string const & type, string const & output_file, string & ba
|
||||
}
|
||||
|
||||
|
||||
int parse_export(string const & type, string const &, string & batch)
|
||||
int parse_export(string const & type, string const & file, string & batch)
|
||||
{
|
||||
if (type.empty()) {
|
||||
lyxerr << to_utf8(_("Missing file type [eg latex, ps...] after "
|
||||
"--export switch")) << endl;
|
||||
exit(1);
|
||||
}
|
||||
if (file.empty()) {
|
||||
lyxerr << to_utf8(_("Missing filename after format")) << endl;
|
||||
exit(1);
|
||||
}
|
||||
batch = "buffer-export " + type;
|
||||
use_gui = false;
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user