mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Add verbose option
Using the option -v (--verbose) all spawned commands are print on the terminal. Note that this was done by default on previous versions.
This commit is contained in:
parent
6e88c0062c
commit
2a371bb4b3
3
lyx.1in
3
lyx.1in
@ -94,6 +94,9 @@ by using the lyxpipe, ask an already running instance of LyX to open the
|
||||
documents passed as arguments and then exit. If the lyxpipe is not set up or
|
||||
is not working, a new instance is created and execution continues normally.
|
||||
.TP
|
||||
\fB \-v [\-\-verbose]\fP
|
||||
print on terminal all spawned external commands.
|
||||
.TP
|
||||
.BI \-batch
|
||||
causes LyX to run the given commands without opening a GUI window.
|
||||
Thus, something like:
|
||||
|
17
src/LyX.cpp
17
src/LyX.cpp
@ -92,6 +92,12 @@ namespace os = support::os;
|
||||
bool use_gui = true;
|
||||
|
||||
|
||||
// Report on the terminal about spawned commands. The default is false
|
||||
// and can be changed with the option -v (--verbose).
|
||||
|
||||
bool verbose = false;
|
||||
|
||||
|
||||
// We default to open documents in an already running instance, provided that
|
||||
// the lyxpipe has been setup. This can be overridden either on the command
|
||||
// line or through preference settings.
|
||||
@ -1161,6 +1167,8 @@ int parse_help(string const &, string const &, string &)
|
||||
"\t-r [--remote]\n"
|
||||
" open documents in an already running instance\n"
|
||||
" (a working lyxpipe is needed)\n"
|
||||
"\t-v [--verbose]\n"
|
||||
" report on terminal about spawned commands.\n"
|
||||
"\t-batch execute commands without launching GUI and exit.\n"
|
||||
"\t-version summarize version and build info\n"
|
||||
"Check the LyX man page for more details.")) << endl;
|
||||
@ -1295,6 +1303,13 @@ int parse_remote(string const &, string const &, string &)
|
||||
}
|
||||
|
||||
|
||||
int parse_verbose(string const &, string const &, string &)
|
||||
{
|
||||
verbose = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int parse_force(string const & arg, string const &, string &)
|
||||
{
|
||||
if (arg == "all") {
|
||||
@ -1342,6 +1357,8 @@ void LyX::easyParse(int & argc, char * argv[])
|
||||
cmdmap["--no-remote"] = parse_noremote;
|
||||
cmdmap["-r"] = parse_remote;
|
||||
cmdmap["--remote"] = parse_remote;
|
||||
cmdmap["-v"] = parse_verbose;
|
||||
cmdmap["--verbose"] = parse_verbose;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
map<string, cmd_helper>::const_iterator it
|
||||
|
@ -51,6 +51,7 @@ enum OverwriteFiles {
|
||||
};
|
||||
|
||||
extern bool use_gui;
|
||||
extern bool verbose;
|
||||
extern RunMode run_mode;
|
||||
extern OverwriteFiles force_overwrite;
|
||||
|
||||
|
@ -66,6 +66,9 @@ using namespace lyx::support;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
// Dummy verbose support
|
||||
bool verbose = false;
|
||||
|
||||
// Dummy LyXRC support
|
||||
struct LyXRC {
|
||||
string icon_set;
|
||||
|
@ -195,6 +195,10 @@ void GuiProgressView::clearText()
|
||||
|
||||
void GuiProgressView::appendLyXErrText(QString const & text)
|
||||
{
|
||||
// Skip verbose messages meant for the terminal
|
||||
if (text.startsWith("\nRunning:"))
|
||||
return;
|
||||
|
||||
widget_->outTE->moveCursor(QTextCursor::End);
|
||||
widget_->outTE->insertPlainText(text);
|
||||
widget_->outTE->ensureCursorVisible();
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "support/os.h"
|
||||
#include "support/ProgressInterface.h"
|
||||
|
||||
#include "LyX.h"
|
||||
#include "LyXRC.h"
|
||||
|
||||
#include <cstdlib>
|
||||
@ -239,6 +240,9 @@ int Systemcall::startscript(Starttype how, string const & what,
|
||||
bool process_events)
|
||||
{
|
||||
string const what_ss = commandPrep(what);
|
||||
if (verbose)
|
||||
lyxerr << "\nRunning: " << what_ss << endl;
|
||||
else
|
||||
LYXERR(Debug::INFO,"Running: " << what_ss);
|
||||
|
||||
string infile;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "LyX.h"
|
||||
#include "LyXRC.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
@ -995,6 +996,11 @@ cmd_ret const runCommand(string const & cmd)
|
||||
// pstream (process stream), with the
|
||||
// variants ipstream, opstream
|
||||
|
||||
if (verbose)
|
||||
lyxerr << "\nRunning: " << cmd << endl;
|
||||
else
|
||||
LYXERR(Debug::INFO,"Running: " << cmd);
|
||||
|
||||
#if defined (_WIN32)
|
||||
STARTUPINFO startup;
|
||||
PROCESS_INFORMATION process;
|
||||
|
@ -47,6 +47,13 @@ namespace Alert {
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Dummy verbose support
|
||||
//
|
||||
|
||||
bool verbose = false;
|
||||
|
||||
|
||||
//
|
||||
// Dummy LyXRC support
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user