From 7354a8f13f774f92dd315d7809d97e2da464786e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 25 Jul 2015 17:23:06 -0400 Subject: [PATCH] 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. --- src/CLI2.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index d4683b6fc..86f5dd4f0 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -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);