CmdContext: Add support for unsetting context
This commit is contained in:
committed by
Paul Beckingham
parent
371ca27da0
commit
1a3550541b
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user