mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
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:
parent
5d98acef29
commit
4b68fea674
1 changed files with 15 additions and 12 deletions
27
src/CLI2.cpp
27
src/CLI2.cpp
|
@ -807,21 +807,24 @@ bool CLI2::findCommand ()
|
|||
// task project=foo list
|
||||
// ^cmd ^cmd
|
||||
// ^attribute
|
||||
if (canonicalize (canonical, "cmd", raw) &&
|
||||
! exactMatch ("attribute", raw))
|
||||
{
|
||||
a.attribute ("canonical", canonical);
|
||||
a.tag ("CMD");
|
||||
if (exactMatch ("cmd", raw))
|
||||
canonical = raw;
|
||||
else if (exactMatch ("attribute", raw))
|
||||
continue;
|
||||
else if (! canonicalize (canonical, "cmd", raw))
|
||||
continue;
|
||||
|
||||
bool readOnly = ! exactMatch ("writecmd", canonical);
|
||||
a.tag (readOnly ? "READCMD" : "WRITECMD");
|
||||
a.attribute ("canonical", canonical);
|
||||
a.tag ("CMD");
|
||||
|
||||
if (context.config.getInteger ("debug.parser") >= 3)
|
||||
context.debug (dump ("CLI2::analyze findCommand"));
|
||||
bool readOnly = ! exactMatch ("writecmd", canonical);
|
||||
a.tag (readOnly ? "READCMD" : "WRITECMD");
|
||||
|
||||
// Stop and indicate command found.
|
||||
return true;
|
||||
}
|
||||
if (context.config.getInteger ("debug.parser") >= 3)
|
||||
context.debug (dump ("CLI2::analyze findCommand"));
|
||||
|
||||
// Stop and indicate command found.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Indicate command not found.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue