From 3ed89393ec7449695888288ab8bdfa5cd8ee55e2 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 26 Sep 2021 21:10:41 -0400 Subject: [PATCH] NewsItem: Add stub --- src/commands/CmdNews.cpp | 23 +++++++++++++++++++++++ src/commands/CmdNews.h | 9 +++++++++ 2 files changed, 32 insertions(+) diff --git a/src/commands/CmdNews.cpp b/src/commands/CmdNews.cpp index 8975571da..2229ba977 100644 --- a/src/commands/CmdNews.cpp +++ b/src/commands/CmdNews.cpp @@ -33,6 +33,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////// CmdNews::CmdNews () @@ -70,6 +71,28 @@ void wait_for_keypress () 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) { diff --git a/src/commands/CmdNews.h b/src/commands/CmdNews.h index b632d2a1e..9abcc5dab 100644 --- a/src/commands/CmdNews.h +++ b/src/commands/CmdNews.h @@ -31,6 +31,15 @@ #include #include +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 { public: