Ignore trailing spaces on CLI commands
This commit is contained in:
parent
35abdb89f5
commit
1b5571e268
|
@ -1667,6 +1667,12 @@ void cliProcess()
|
||||||
clicmd_t *cmd = NULL;
|
clicmd_t *cmd = NULL;
|
||||||
clicmd_t target;
|
clicmd_t target;
|
||||||
cliPrint("\r\n");
|
cliPrint("\r\n");
|
||||||
|
|
||||||
|
// Strip trailing whitespace
|
||||||
|
while (bufferIndex > 0 && cliBuffer[bufferIndex - 1] == ' ') {
|
||||||
|
bufferIndex--;
|
||||||
|
}
|
||||||
|
|
||||||
cliBuffer[bufferIndex] = 0; // null terminate
|
cliBuffer[bufferIndex] = 0; // null terminate
|
||||||
|
|
||||||
if (cliBuffer[0] != '#') {
|
if (cliBuffer[0] != '#') {
|
||||||
|
@ -1695,8 +1701,8 @@ void cliProcess()
|
||||||
cliPrint("\010 \010");
|
cliPrint("\010 \010");
|
||||||
}
|
}
|
||||||
} else if (bufferIndex < sizeof(cliBuffer) && c >= 32 && c <= 126) {
|
} else if (bufferIndex < sizeof(cliBuffer) && c >= 32 && c <= 126) {
|
||||||
if (!bufferIndex && c == 32)
|
if (!bufferIndex && c == ' ')
|
||||||
continue;
|
continue; // Ignore leading spaces
|
||||||
cliBuffer[bufferIndex++] = c;
|
cliBuffer[bufferIndex++] = c;
|
||||||
cliWrite(c);
|
cliWrite(c);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue