]> git.lyx.org Git - lyx.git/commitdiff
Add verbose option
authorEnrico Forestieri <forenr@lyx.org>
Wed, 17 Aug 2016 20:32:14 +0000 (22:32 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Wed, 17 Aug 2016 20:32:14 +0000 (22:32 +0200)
Using the option -v (--verbose) all spawned commands are print
on the terminal. Note that this was done by default on previous
versions.

lyx.1in
src/LyX.cpp
src/LyX.h
src/client/client.cpp
src/frontends/qt4/GuiProgressView.cpp
src/support/Systemcall.cpp
src/support/filetools.cpp
src/tex2lyx/dummy_impl.cpp

diff --git a/lyx.1in b/lyx.1in
index 8f81660020f792b81312995ee6c015660a83e24d..ed1be04b181a223504347d7f00a7c464dbc9b4f7 100644 (file)
--- a/lyx.1in
+++ b/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:
index a732c7ee809e5fcd9a0b52429394e3133d6f96c9..fec82818b6888c8c699607bd15fa41dc8f2cabd7 100644 (file)
@@ -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
index a19b5234594047a81bec19802efa9d1f80df4c64..4b9c201e258b86e1cbc3db8849639af6315f2e0b 100644 (file)
--- a/src/LyX.h
+++ b/src/LyX.h
@@ -51,6 +51,7 @@ enum OverwriteFiles {
 };
 
 extern bool use_gui;
+extern bool verbose;
 extern RunMode run_mode;
 extern OverwriteFiles force_overwrite;
 
index a950f8303bd02ae90261426905ce84a654ed3e26..023e73e96b44e45facfb9af06232bd0164a0287b 100644 (file)
@@ -66,6 +66,9 @@ using namespace lyx::support;
 
 namespace lyx {
 
+// Dummy verbose support
+bool verbose = false;
+
 // Dummy LyXRC support
 struct LyXRC {
        string icon_set;
index 3a8f0754d9cfb19db9c8872cae9de0345bdb041c..166eed752c4550c7b51c2d68990043876c1ac352 100644 (file)
@@ -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();
index 5dd4a94e1681e206b4ca4a5f7cdcf0c81a5769c8..cc2c3814ab761c17ec360316f1b071e7ea5e21aa 100644 (file)
@@ -23,6 +23,7 @@
 #include "support/os.h"
 #include "support/ProgressInterface.h"
 
+#include "LyX.h"
 #include "LyXRC.h"
 
 #include <cstdlib>
@@ -239,7 +240,10 @@ int Systemcall::startscript(Starttype how, string const & what,
                            bool process_events)
 {
        string const what_ss = commandPrep(what);
-       LYXERR(Debug::INFO,"Running: " << what_ss);
+       if (verbose)
+               lyxerr << "\nRunning: " << what_ss << endl;
+       else
+               LYXERR(Debug::INFO,"Running: " << what_ss);
 
        string infile;
        string outfile;
index b28d81210c48283395c566dca52bd898994848cc..fcb95faca044afeb201680c3952e326093153b4f 100644 (file)
@@ -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;
index 770966391459e499e84474abd4d7f76301c6aafc..8ad5b7985908c109ea3e7494e4a2f8999dbb9f63 100644 (file)
@@ -47,6 +47,13 @@ namespace Alert {
 }
 
 
+//
+// Dummy verbose support
+//
+
+bool verbose = false;
+
+
 //
 // Dummy LyXRC support
 //