mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Parser
- defaultCommand may contains multiple arguments, and so Lexer::split is used to properly split it into arguments.
This commit is contained in:
parent
7d69c687b2
commit
38fdbdaa50
1 changed files with 13 additions and 2 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <unistd.h>
|
||||
#include <Context.h>
|
||||
#include <Parser.h>
|
||||
#include <Lexer.h>
|
||||
#include <Nibbler.h>
|
||||
#include <Directory.h>
|
||||
#include <main.h>
|
||||
|
@ -461,8 +462,18 @@ void Parser::injectDefaults ()
|
|||
if (defaultCommand != "")
|
||||
{
|
||||
context.debug ("No command or sequence found - assuming default.command.");
|
||||
Tree* t = captureFirst (defaultCommand);
|
||||
t->tag ("DEFAULT");
|
||||
|
||||
// Split the defaultCommand into args, and add them in reverse order,
|
||||
// because captureFirst inserts args immediately after the command, and
|
||||
// so has the effect of reversing the list.
|
||||
std::vector <std::string> args;
|
||||
Lexer::split (args, defaultCommand);
|
||||
std::vector <std::string>::reverse_iterator r;
|
||||
for (r = args.rbegin (); r != args.rend (); ++r)
|
||||
{
|
||||
Tree* t = captureFirst (*r);
|
||||
t->tag ("DEFAULT");
|
||||
}
|
||||
|
||||
std::string combined;
|
||||
std::vector <Tree*>::iterator i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue