CLI: Removed ::findCommand, which is replaced by ::canonicalizeNames

This commit is contained in:
Paul Beckingham 2016-04-03 13:09:22 -04:00
parent 68ba48e85f
commit 2360509b98
2 changed files with 0 additions and 34 deletions

View file

@ -223,7 +223,6 @@ void CLI::analyze ()
_args.clear ();
handleArg0 ();
lexArguments ();
findCommand ();
canonicalizeNames ();
}
@ -328,38 +327,6 @@ void CLI::canonicalizeNames ()
}
}
////////////////////////////////////////////////////////////////////////////////
// Scan all arguments and if any are an exact match for a command name, then
// tag as CMD. If an argument is an exact match for an attribute, despite being
// an inexact match for a command, then it is not a command.
bool CLI::findCommand ()
{
for (auto& a : _args)
{
auto raw = a.attribute ("raw");
std::string canonical;
// If the arg canonicalized to a 'cmd', but is also not an exact match
// for an 'attribute', proceed. Example:
// task project=foo list
// ^cmd ^cmd
// ^attribute
if (exactMatch ("command", raw))
canonical = raw;
else if (! canonicalize (canonical, "command", raw))
continue;
a.attribute ("canonical", canonical);
a.tag ("CMD");
// Stop and indicate command found.
return true;
}
// Indicate command not found.
return false;
}
////////////////////////////////////////////////////////////////////////////////
// Search for exact 'value' in _entities category.
bool CLI::exactMatch (

View file

@ -66,7 +66,6 @@ private:
void handleArg0 ();
void lexArguments ();
void canonicalizeNames ();
bool findCommand ();
bool exactMatch (const std::string&, const std::string&) const;
public: