mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CmdContext: Add show subcommand
This commit is contained in:
parent
1a3550541b
commit
09fe5be086
2 changed files with 20 additions and 0 deletions
|
@ -66,6 +66,8 @@ int CmdContext::execute (std::string& output)
|
|||
rc = listContexts(words, out);
|
||||
else if (subcommand == "none")
|
||||
rc = unsetContext(words, out);
|
||||
else if (subcommand == "show")
|
||||
rc = showContext(words, out);
|
||||
else
|
||||
rc = setContext(words, out);
|
||||
}
|
||||
|
@ -231,6 +233,23 @@ int CmdContext::setContext (std::vector <std::string>& words, std::stringstream&
|
|||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdContext::showContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
// task context show
|
||||
std::string currentContext = context.config.get ("context");
|
||||
|
||||
if (currentContext == "")
|
||||
out << "No context is currently applied." << "\n";
|
||||
else
|
||||
{
|
||||
std::string currentFilter = context.config.get ("context." + currentContext);
|
||||
out << format ("Context '{1}' with filter '{2}' is currently applied.", currentContext, currentFilter) << "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdContext::unsetContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
|
|
|
@ -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 showContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
int unsetContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue