display: add warning message

This commit is contained in:
Gwenhael Goavec-Merou 2021-01-28 07:22:24 +01:00
parent dbc78f8c57
commit 71c4b32202
2 changed files with 12 additions and 0 deletions

View File

@ -42,6 +42,17 @@ void printError(std::string err, bool eol)
std::cerr << std::endl;
}
void printWarn(std::string warn, bool eol)
{
if (isatty(STDOUT_FILENO))
std::cout << KYEL << warn << "\e[0m" << std::flush;
else
std::cout << warn;
std::cout << std::flush;
if (eol)
std::cout << std::endl;
}
void printInfo(std::string info, bool eol)
{
if (isatty(STDOUT_FILENO))

View File

@ -22,6 +22,7 @@
#include <string>
void printError(std::string err, bool eol = true);
void printWarn(std::string warn, bool eol = true);
void printInfo(std::string info, bool eol = true);
void printSuccess(std::string success, bool eol = true);