CLI2: Fixed bug in ::findCommand
- If an argument is an exact match for a command ('projects'), it is a command.
- If an argument is not an exact match for command ('project'), but is an exact
match for an attribute, it is not a command.
- If an argument fails the above tests, but canonicalizes to a command, it is a
command.
This commit is contained in:
11
src/CLI2.cpp
11
src/CLI2.cpp
@@ -807,9 +807,13 @@ bool CLI2::findCommand ()
|
||||
// task project=foo list
|
||||
// ^cmd ^cmd
|
||||
// ^attribute
|
||||
if (canonicalize (canonical, "cmd", raw) &&
|
||||
! exactMatch ("attribute", raw))
|
||||
{
|
||||
if (exactMatch ("cmd", raw))
|
||||
canonical = raw;
|
||||
else if (exactMatch ("attribute", raw))
|
||||
continue;
|
||||
else if (! canonicalize (canonical, "cmd", raw))
|
||||
continue;
|
||||
|
||||
a.attribute ("canonical", canonical);
|
||||
a.tag ("CMD");
|
||||
|
||||
@@ -822,7 +826,6 @@ bool CLI2::findCommand ()
|
||||
// Stop and indicate command found.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Indicate command not found.
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user