mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CmdContext: Utilize new reason-providing validateWriteContext
This commit is contained in:
parent
5d8f8dac35
commit
493f36ecdd
1 changed files with 3 additions and 4 deletions
|
@ -221,14 +221,13 @@ void CmdContext::defineContext (const std::vector <std::string>& words, std::str
|
|||
! confirm (format ("The filter '{1}' matches 0 pending tasks. Do you wish to continue?", value)))
|
||||
throw std::string ("Context definition aborted.");
|
||||
|
||||
std::string modifier_token = "";
|
||||
bool valid_write_context = CmdContext::validateWriteContext (lexedArgs, modifier_token);
|
||||
std::string reason = "";
|
||||
bool valid_write_context = CmdContext::validateWriteContext (lexedArgs, reason);
|
||||
|
||||
if (! valid_write_context)
|
||||
{
|
||||
std::stringstream warning;
|
||||
warning << format ("The filter '{1}' is not a valid modification string, because it contains ", value)
|
||||
<< ( modifier_token.empty () ? "the OR operator." : format ("an attribute modifier ({1}).", modifier_token) )
|
||||
warning << format ("The filter '{1}' is not a valid modification string, because it contains {2}.", value, reason)
|
||||
<< "\nAs such, value for the write context cannot be set (context will not apply on task add / task log).\n\n"
|
||||
<< format ("Please use 'task config context.{1}.write <default mods>' to set default attribute values for new tasks in this context manually.\n\n", words[1]);
|
||||
out << colorizeFootnote (warning.str ());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue