mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CmdContext: Add support for unsetting context
This commit is contained in:
parent
371ca27da0
commit
1a3550541b
2 changed files with 21 additions and 0 deletions
|
@ -64,6 +64,8 @@ int CmdContext::execute (std::string& output)
|
|||
rc = deleteContext(words, out);
|
||||
else if (subcommand == "list")
|
||||
rc = listContexts(words, out);
|
||||
else if (subcommand == "none")
|
||||
rc = unsetContext(words, out);
|
||||
else
|
||||
rc = setContext(words, out);
|
||||
}
|
||||
|
@ -229,6 +231,24 @@ int CmdContext::setContext (std::vector <std::string>& words, std::stringstream&
|
|||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdContext::unsetContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
// task context none
|
||||
int rc = 0;
|
||||
int status = CmdConfig::unsetConfigVariable("context", false);
|
||||
|
||||
if (status == 0)
|
||||
out << "Context unset." << "\n";
|
||||
else
|
||||
{
|
||||
out << "Context not unset." << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdCompletionContext::CmdCompletionContext ()
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
int deleteContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
int listContexts (std::vector <std::string>& words, std::stringstream& out);
|
||||
int setContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
int unsetContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
};
|
||||
|
||||
class CmdCompletionContext : public Command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue