From d092aaa2e52fc6d1a14317ba1b9c9440da012ee1 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 25 Sep 2021 23:24:26 -0400 Subject: [PATCH] CmdNews: Set news.version configuration variable upon success --- src/commands/CmdNews.cpp | 9 ++++++++- src/commands/CmdNews.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/commands/CmdNews.cpp b/src/commands/CmdNews.cpp index b3440a7bb..4aa00a804 100644 --- a/src/commands/CmdNews.cpp +++ b/src/commands/CmdNews.cpp @@ -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; } diff --git a/src/commands/CmdNews.h b/src/commands/CmdNews.h index df01a253c..b632d2a1e 100644 --- a/src/commands/CmdNews.h +++ b/src/commands/CmdNews.h @@ -29,6 +29,7 @@ #include #include +#include class CmdNews : public Command {