mirror of
https://github.com/GothenburgBitFactory/taskshell.git
synced 2025-06-26 10:54:29 +02:00
command args: trim leading/trailing whitespace
When certain commands in tasksh (such as 'review N') contain whitespace, such as: review '1 ' The whitespace would tokenise into the command arg vector, effectively treating the whitespace as a literal component. In the case of the 'review' command, this is undesirable. Therefore, strip out all leading/trailing whitespace from the command args vector. Fixes GH issue #43
This commit is contained in:
parent
68d8a9acac
commit
d70e1894a4
1 changed files with 7 additions and 1 deletions
|
@ -113,7 +113,13 @@ static int commandLoop (bool autoClear)
|
|||
}
|
||||
else if (command != "")
|
||||
{
|
||||
auto args = split (command, ' ');
|
||||
std::vector<std::string> args;
|
||||
std::string n;
|
||||
for (const auto& s : split (command, ' '))
|
||||
{
|
||||
if ((n = trim(s)) != "")
|
||||
args.push_back(n);
|
||||
}
|
||||
|
||||
// Dispatch command.
|
||||
if (args[0] == "<EOF>") status = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue