Parcourir la source

Merge branch 'feature/#68-hide-command-echo-on-unknown-command-when-echo-is-turned-off' of shimatta/shellmatta into develop

close #68
shimatta il y a 9 mois
Parent
commit
280af5b811
2 fichiers modifiés avec 12 ajouts et 5 suppressions
  1. 10 3
      src/shellmatta.c
  2. 2 2
      test/integrationtest/test_integration.cpp

+ 10 - 3
src/shellmatta.c

@@ -670,9 +670,16 @@ shellmatta_retCode_t shellmatta_processData(shellmatta_handle_t     handle,
 
                     if ((0u == cmdExecuted) && (inst->inputCount > 0))
                     {
-                        inst->write("\r\nCommand: ", 11u);
-                        inst->write(inst->buffer, inst->inputCount);
-                        inst->write(" not found", 10u);
+                        if (inst->echoEnabled)
+                        {
+                            inst->write("\r\nCommand: ", 11u);
+                            inst->write(inst->buffer, inst->inputCount);
+                            inst->write(" not found", 10u);
+                        }
+                        else
+                        {
+                            inst->write("\r\nCommand not found!", 20u);
+                        }
                     }
 
                     /** -# terminate this session if no continuous mode is requested */

+ 2 - 2
test/integrationtest/test_integration.cpp

@@ -418,9 +418,9 @@ TEST_CASE( "shellmatta configure mode" ) {
     shellmatta_retCode_t ret;
     char buffer[1024];
     char historyBuffer[1024];
-    char *dummyData =   (char*)"\r\nCommand: meow this is some dum123456my Text not found\r\nshellmatta->";
+    char *dummyData =   (char*)"\r\nCommand not found!\r\nshellmatta->";
 
-    char *dummyData2 =   (char*)"\r\nCommand: meow this is some dum123456t not found\r\nshellmatta->";
+    char *dummyData2 =   (char*)"\r\nCommand not found!\r\nshellmatta->";
 
     shellmatta_doInit(  &inst,
                         &handle,