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:
Paul Beckingham 2015-07-25 17:23:06 -04:00
parent 3fd8545d43
commit 7354a8f13f

View file

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