CLI2: Context not applied for certain commands and args
- The 'undo', 'export' and all helper commands are exempt from context filtering. - Any command line containing a FILTER with Lexer:Type::set or Lexer::Type:uuid is also exempt from context filtering.
This commit is contained in:
19
src/CLI2.cpp
19
src/CLI2.cpp
@@ -566,34 +566,31 @@ void CLI2::addContextFilter ()
|
|||||||
std::string contextName = context.config.get ("context");
|
std::string contextName = context.config.get ("context");
|
||||||
if (contextName == "")
|
if (contextName == "")
|
||||||
{
|
{
|
||||||
context.debug ("No context applied.");
|
context.debug ("No context.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The 'undo' command does not apply context.
|
// Some commands operate independently of context.
|
||||||
auto cmd = getCommand ();
|
auto cmd = getCommand ();
|
||||||
if (cmd == "undo" ||
|
if (cmd == "undo" ||
|
||||||
cmd == "export" ||
|
cmd == "export" ||
|
||||||
cmd[0] == '_')
|
cmd[0] == '_')
|
||||||
|
{
|
||||||
|
context.debug ("Context-free command.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Detect if UUID or ID is set, and bail out
|
// Detect if UUID or ID is set, and bail out
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
// TODO This is needed, but the parsing is not yet complete, so the logic
|
if ((a._lextype == Lexer::Type::uuid ||
|
||||||
// below is not valid.
|
a._lextype == Lexer::Type::set) &&
|
||||||
if (a.hasTag ("FILTER") &&
|
a.hasTag ("FILTER"))
|
||||||
a.hasTag ("ATTRIBUTE") &&
|
|
||||||
! a.hasTag ("TERMINATED") &&
|
|
||||||
! a.hasTag ("WORD") &&
|
|
||||||
(a.attribute ("raw") == "id" || a.attribute ("raw") == "uuid"))
|
|
||||||
{
|
{
|
||||||
context.debug (format ("UUID/ID lexeme found '{1}', not applying context.", a.attribute ("raw")));
|
context.debug (format ("UUID/ID lexeme found '{1}', not applying context.", a.attribute ("raw")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Apply context
|
// Apply context
|
||||||
context.debug ("Applying context: " + contextName);
|
context.debug ("Applying context: " + contextName);
|
||||||
|
|||||||
Reference in New Issue
Block a user