NewsItem: Add stub

This commit is contained in:
Tomas Babej 2021-09-26 21:10:41 -04:00
parent 36bdd81d46
commit 3ed89393ec
2 changed files with 32 additions and 0 deletions

View file

@ -33,6 +33,7 @@
#include <shared.h> #include <shared.h>
#include <format.h> #include <format.h>
#include <util.h> #include <util.h>
#include <main.h>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CmdNews::CmdNews () CmdNews::CmdNews ()
@ -70,6 +71,28 @@ void wait_for_keypress ()
signal (SIGINT, SIG_DFL); signal (SIGINT, SIG_DFL);
} }
////////////////////////////////////////////////////////////////////////////////
// Holds information about single improvement / bug.
//
NewsItem::NewsItem (bool major, const std::string& title, const std::string& update) {
_major = major;
_title = title;
_update = update;
}
void NewsItem::render () {
auto config = Context::getContext ().config;
Color header;
if (Context::getContext ().color ()) {
header = Color ("bold");
if (config.has ("color.header"))
header.blend(Color (config.get ("color.header")));
}
std::cout << header.colorize (format ("{1}\n", _title));
std::cout << format ("\n{1}\n", _update);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CmdNews::execute (std::string& output) int CmdNews::execute (std::string& output)
{ {

View file

@ -31,6 +31,15 @@
#include <Command.h> #include <Command.h>
#include <CmdConfig.h> #include <CmdConfig.h>
class NewsItem {
public:
bool _major = false;
std::string _title;
std::string _update;
NewsItem (bool, const std::string&, const std::string&);
void render ();
};
class CmdNews : public Command class CmdNews : public Command
{ {
public: public: