mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +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.
|
||||
void Parser::findCommand ()
|
||||
{
|
||||
context.debug ("Parse::findOverrides");
|
||||
std::vector <Tree*> nodes;
|
||||
collect (nodes, false);
|
||||
|
||||
// There can be only one.
|
||||
// Scan for an existing CMD tag, to short-circuit scanning for another.
|
||||
std::string command;
|
||||
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"))
|
||||
return;
|
||||
|
||||
// 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")))
|
||||
{
|
||||
(*i)->unTag ("?");
|
||||
|
@ -500,6 +496,8 @@ void Parser::findCommand ()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
context.debug (_tree->dump ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue