CLI2: Fixed bug recognizing command names

- If a command is found via canonicalization, but that command is also an exact
  match for an attribute, then it is not a command.
This commit is contained in:
Paul Beckingham 2015-06-22 11:55:55 -04:00
parent fd35190ab0
commit 02b91a94fc

View file

@ -798,8 +798,16 @@ bool CLI2::findCommand ()
{
for (auto& a : _args)
{
std::string raw = a.attribute ("raw");
std::string canonical;
if (canonicalize (canonical, "cmd", a.attribute ("raw")))
// 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 (canonicalize (canonical, "cmd", raw) &&
! exactMatch ("attribute", raw))
{
a.attribute ("canonical", canonical);
a.tag ("CMD");