mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 15:47:19 +02:00
CmdCustom: Generate notice about task news
This commit is contained in:
parent
5ccfece56d
commit
ef53c4fc75
1 changed files with 24 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <CmdCustom.h>
|
#include <CmdCustom.h>
|
||||||
|
#include <random>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -248,6 +249,29 @@ int CmdCustom::execute (std::string& output)
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inform user about the new release higlights if not presented yet
|
||||||
|
if (Context::getContext ().config.get ("news.version") != "2.6.0")
|
||||||
|
{
|
||||||
|
std::random_device device;
|
||||||
|
std::mt19937 random_generator(device());
|
||||||
|
std::uniform_int_distribution<std::mt19937::result_type> ten_percent(1, 10);
|
||||||
|
|
||||||
|
std::string NEWS_NOTICE = (
|
||||||
|
"Recently upgraded to 2.6.0. "
|
||||||
|
"Please run 'task news' to read higlights about the new release."
|
||||||
|
);
|
||||||
|
|
||||||
|
// 1 in 10 chance to display the message.
|
||||||
|
if (ten_percent(random_generator) == 10)
|
||||||
|
{
|
||||||
|
if (Context::getContext ().verbose ("footnote"))
|
||||||
|
Context::getContext ().footnote (NEWS_NOTICE);
|
||||||
|
else if (Context::getContext ().verbose ("header"))
|
||||||
|
Context::getContext ().header (NEWS_NOTICE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
feedback_backlog ();
|
feedback_backlog ();
|
||||||
output = out.str ();
|
output = out.str ();
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue