CLI2: Apply UUID/ID context break only for readable context
The purpose of this break is to not apply the context on commands like
task 4 info
so that we can still refer to tasks directly (using their ID/UUID
references) even if they fall outside of the currectly active context.
However, this break should not be applied for writeable context. This is
because the lexer can (a bit misleadingly) label parts of the desription
of the new task as number/identifier tokens
task add Replace 3 parts of the puzzle abc123
^ ^
type::number type:uuid
which would trigger the break unnecessarily.
Closes #2550.
This commit is contained in:
19
src/CLI2.cpp
19
src/CLI2.cpp
@@ -607,17 +607,18 @@ void CLI2::addContext (bool readable, bool writeable)
|
||||
if (contextString.empty ())
|
||||
return;
|
||||
|
||||
// Detect if UUID or ID is set, and bail out
|
||||
for (auto& a : _args)
|
||||
{
|
||||
if (a._lextype == Lexer::Type::uuid ||
|
||||
a._lextype == Lexer::Type::number ||
|
||||
a._lextype == Lexer::Type::set)
|
||||
// For readable contexts: Detect if UUID or ID is set, and bail out
|
||||
if (readable)
|
||||
for (auto& a : _args)
|
||||
{
|
||||
Context::getContext ().debug (format ("UUID/ID argument found '{1}', not applying context.", a.attribute ("raw")));
|
||||
return;
|
||||
if (a._lextype == Lexer::Type::uuid ||
|
||||
a._lextype == Lexer::Type::number ||
|
||||
a._lextype == Lexer::Type::set)
|
||||
{
|
||||
Context::getContext ().debug (format ("UUID/ID argument found '{1}', not applying context.", a.attribute ("raw")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the context. Readable (filtering) takes precedence. Also set the
|
||||
// block now, since addFilter calls analyze(), which calls addContext().
|
||||
|
||||
Reference in New Issue
Block a user