mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
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:
parent
3fd8545d43
commit
7354a8f13f
1 changed files with 8 additions and 11 deletions
19
src/CLI2.cpp
19
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue