mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-03 07:07:19 +02:00
Parser
- Modified ::findCommand to use collect.
This commit is contained in:
parent
4ef7d9c7fb
commit
f1a61aaeb6
1 changed files with 9 additions and 11 deletions
|
@ -466,25 +466,21 @@ void Parser::resolveAliases ()
|
||||||
// autoCompletes to a valid command/report.
|
// autoCompletes to a valid command/report.
|
||||||
void Parser::findCommand ()
|
void Parser::findCommand ()
|
||||||
{
|
{
|
||||||
|
context.debug ("Parse::findOverrides");
|
||||||
|
std::vector <Tree*> nodes;
|
||||||
|
collect (nodes, false);
|
||||||
|
|
||||||
// There can be only one.
|
// There can be only one.
|
||||||
// Scan for an existing CMD tag, to short-circuit scanning for another.
|
// Scan for an existing CMD tag, to short-circuit scanning for another.
|
||||||
std::string command;
|
|
||||||
std::vector <Tree*>::iterator i;
|
std::vector <Tree*>::iterator i;
|
||||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||||
if ((*i)->hasTag ("CMD"))
|
if ((*i)->hasTag ("CMD"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// No CMD tag found, now look for a command.
|
// No CMD tag found, now look for a command.
|
||||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
std::string command;
|
||||||
|
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||||
{
|
{
|
||||||
// Parser override operator.
|
|
||||||
if ((*i)->attribute ("raw") == "--")
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Skip known args.
|
|
||||||
if (! (*i)->hasTag ("?"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (canonicalize (command, "cmd", (*i)->attribute ("raw")))
|
if (canonicalize (command, "cmd", (*i)->attribute ("raw")))
|
||||||
{
|
{
|
||||||
(*i)->unTag ("?");
|
(*i)->unTag ("?");
|
||||||
|
@ -500,6 +496,8 @@ void Parser::findCommand ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.debug (_tree->dump ());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue