[CLI] Print executed from command script commands
authorAlexander Soldatov <soldatov.a@samsung.com>
Mon, 18 Oct 2021 18:19:49 +0000 (21:19 +0300)
committerAlexander Soldatov/Platform Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>
Tue, 19 Oct 2021 11:17:09 +0000 (14:17 +0300)
src/protocols/cliprotocol.cpp
src/protocols/cliprotocol.h

index f8462b96cea93ca0ab499cd3fb825fd12a014b44..0f6ea938fa1a8208d3e43ddb309a8296192ceaea 100644 (file)
@@ -1833,7 +1833,7 @@ HRESULT CLIProtocol::doCommand<CommandTag::Source>(const std::vector<std::string
         return E_FAIL;
     }
 
-    return execCommands(FileLineReader(std::move(file)));
+    return execCommands(FileLineReader(std::move(file)), true);
 }
 
 
@@ -2218,7 +2218,7 @@ std::tuple<string_view, CLIProtocol::LineReader::Result> CLIProtocol::getLine(co
 }
 
 
-HRESULT CLIProtocol::execCommands(LineReader&& lr)
+HRESULT CLIProtocol::execCommands(LineReader&& lr, bool printCommands)
 {
     // preserve currently existing line reader and restore it on exit
     auto restorer = [&](LineReader* save) { line_reader = save; };
@@ -2325,6 +2325,10 @@ HRESULT CLIProtocol::execCommands(LineReader&& lr)
         };
 
         LOGD("executing: '%.*s'", int(input.size()), input.data());
+
+        if (printCommands) {
+            printf("%s\n", input.data());
+        }
         line_reader->setLastCommand(input);
         auto unparsed = CommandsList::cli_helper.eval(input, handler);
         if (!have_result)
index 432f2fb1c322c40108f1422e4026bff629802c66..89fdea4d201289c290902052480b483b35f3eac2 100644 (file)
@@ -218,7 +218,7 @@ private:
 
     // This function interprets commands from the input till reaching Eof or Error.
     // Function returns E_FAIL in case of input error.
-    HRESULT execCommands(LineReader&&);
+    HRESULT execCommands(LineReader&&, bool printCommands = false);
 
     // update screen (after asynchronous message printed)
     void repaint();