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:
27
src/CLI2.cpp
27
src/CLI2.cpp
@@ -807,21 +807,24 @@ bool CLI2::findCommand ()
|
|||||||
// task project=foo list
|
// task project=foo list
|
||||||
// ^cmd ^cmd
|
// ^cmd ^cmd
|
||||||
// ^attribute
|
// ^attribute
|
||||||
if (canonicalize (canonical, "cmd", raw) &&
|
if (exactMatch ("cmd", raw))
|
||||||
! exactMatch ("attribute", raw))
|
canonical = raw;
|
||||||
{
|
else if (exactMatch ("attribute", raw))
|
||||||
a.attribute ("canonical", canonical);
|
continue;
|
||||||
a.tag ("CMD");
|
else if (! canonicalize (canonical, "cmd", raw))
|
||||||
|
continue;
|
||||||
|
|
||||||
bool readOnly = ! exactMatch ("writecmd", canonical);
|
a.attribute ("canonical", canonical);
|
||||||
a.tag (readOnly ? "READCMD" : "WRITECMD");
|
a.tag ("CMD");
|
||||||
|
|
||||||
if (context.config.getInteger ("debug.parser") >= 3)
|
bool readOnly = ! exactMatch ("writecmd", canonical);
|
||||||
context.debug (dump ("CLI2::analyze findCommand"));
|
a.tag (readOnly ? "READCMD" : "WRITECMD");
|
||||||
|
|
||||||
// Stop and indicate command found.
|
if (context.config.getInteger ("debug.parser") >= 3)
|
||||||
return true;
|
context.debug (dump ("CLI2::analyze findCommand"));
|
||||||
}
|
|
||||||
|
// Stop and indicate command found.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate command not found.
|
// Indicate command not found.
|
||||||
|
|||||||
Reference in New Issue
Block a user