CmdNews: Set news.version configuration variable upon success

This commit is contained in:
Tomas Babej 2021-09-25 23:24:26 -04:00
parent 63c176ea0e
commit d092aaa2e5
2 changed files with 9 additions and 1 deletions

View file

@ -74,12 +74,19 @@ void wait_for_keypress ()
int CmdNews::execute (std::string& output)
{
auto words = Context::getContext ().cli2.getWords ();
auto config = Context::getContext ().config;
std::cout << "Taskwarrior 2.6.0 Release Notes" << std::endl;
wait_for_keypress ();
output = "Thank you for catching up on new features!\n";
// Set a mark in the config to remember which version's release notes were displayed
if (config.get ("news.version") == "2.6.0")
output = "Repetition is the mother of all learning!\n";
else {
CmdConfig::setConfigVariable ("news.version", "2.6.0", false);
output = "Thank you for catching up on the new features!\n";
}
return 0;
}

View file

@ -29,6 +29,7 @@
#include <string>
#include <Command.h>
#include <CmdConfig.h>
class CmdNews : public Command
{