skip over spaces and tabs to find a command fed to it, and find the end of the command by looking for both spaces and tabs
Some checks failed
Build library / Clang Tidy (push) Has been cancelled
Build library / ASAN (push) Has been cancelled
Build library / Linux Ubuntu 22.04 (push) Has been cancelled
Build library / macOS 11 (push) Has been cancelled
Build library / Windows 2019 (push) Has been cancelled
Build library / Source code archive (push) Has been cancelled
Build library / Linux libsndfile (push) Has been cancelled
Build library / Linux makefile (push) Has been cancelled
Build library / deploy (push) Has been cancelled

This commit is contained in:
Ambrose Li 2024-05-29 15:19:28 -04:00 committed by Paul Ferrand
parent c52e2d6f33
commit f5c6e29f23

View file

@ -221,13 +221,14 @@ std::vector<std::string> stringTokenize(const std::string& str)
void cliThreadProc() void cliThreadProc()
{ {
const std::string whitespace = " \t";
while (!shouldClose) { while (!shouldClose) {
std::cout << "\n> "; std::cout << "\n> ";
std::string command; std::string command;
std::getline(std::cin, command); std::getline(std::cin, command);
std::size_t start = command.length()? command.find_first_not_of(" "): 0; std::size_t start = command.length()? command.find_first_not_of(whitespace): 0;
std::size_t pos = command.find(" ", start); std::size_t pos = command.find_first_of(whitespace, start);
std::string kw = command.substr(start, pos - start); std::string kw = command.substr(start, pos - start);
std::string args = command.substr(pos + 1); std::string args = command.substr(pos + 1);
std::vector<std::string> tokens = stringTokenize(args); std::vector<std::string> tokens = stringTokenize(args);