CmdNews: Add reasoning and actions subsections

This commit is contained in:
Tomas Babej 2021-09-27 22:38:29 -04:00
parent e538e9199c
commit c8240f1ad7
2 changed files with 20 additions and 2 deletions

View file

@ -76,18 +76,28 @@ void wait_for_enter ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Holds information about single improvement / bug. // Holds information about single improvement / bug.
// //
NewsItem::NewsItem (bool major, const std::string& title, const std::string& update) { NewsItem::NewsItem (
bool major,
const std::string& title,
const std::string& update,
const std::string& reasoning,
const std::string& actions
) {
_major = major; _major = major;
_title = title; _title = title;
_update = update; _update = update;
_reasoning = reasoning;
_actions = actions;
} }
void NewsItem::render () { void NewsItem::render () {
auto config = Context::getContext ().config; auto config = Context::getContext ().config;
Color header; Color header;
Color bold; Color bold;
Color underline;
if (Context::getContext ().color ()) { if (Context::getContext ().color ()) {
bold = Color ("bold"); bold = Color ("bold");
underline = Color ("underline");
if (config.has ("color.header")) if (config.has ("color.header"))
header = Color (config.get ("color.header")); header = Color (config.get ("color.header"));
} }
@ -96,6 +106,12 @@ void NewsItem::render () {
// Apply this workaround of colorizing twice. // Apply this workaround of colorizing twice.
std::cout << bold.colorize (header.colorize (format ("{1}\n", _title))); std::cout << bold.colorize (header.colorize (format ("{1}\n", _title)));
std::cout << format ("\n{1}\n", _update); std::cout << format ("\n{1}\n", _update);
if (_reasoning.size ())
std::cout << "\n " << underline.colorize ("What is the motivation for this feature?\n")
<< _reasoning << std::endl;
if (_actions.size ())
std::cout << "\n " << underline.colorize ("What do I have to do?\n")
<< _actions << std::endl;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -36,7 +36,9 @@ public:
bool _major = false; bool _major = false;
std::string _title; std::string _title;
std::string _update; std::string _update;
NewsItem (bool, const std::string&, const std::string&); std::string _reasoning;
std::string _actions;
NewsItem (bool, const std::string&, const std::string&, const std::string& = "", const std::string& = "");
void render (); void render ();
}; };