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:
10
src/CLI2.cpp
10
src/CLI2.cpp
@@ -798,8 +798,16 @@ bool CLI2::findCommand ()
|
|||||||
{
|
{
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
|
std::string raw = a.attribute ("raw");
|
||||||
std::string canonical;
|
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.attribute ("canonical", canonical);
|
||||||
a.tag ("CMD");
|
a.tag ("CMD");
|
||||||
|
|||||||
Reference in New Issue
Block a user