Compare commits

...

2 Commits

Author SHA1 Message Date
LordMZTE 8d2041e946
feat: add colored output 2022-11-09 16:09:13 +01:00
LordMZTE 5034e42a2c
fix: add pragma once to headers 2022-11-09 16:08:54 +01:00
8 changed files with 28 additions and 6 deletions

9
src/ansi.hpp Normal file
View File

@ -0,0 +1,9 @@
#pragma once
namespace ansi {
const char *reset = "\033[0m";
const char *cyan = "\033[0;36m";
const char *green = "\033[0;32m";
const char *yellow = "\033[0;33m";
} // namespace ansi

View File

@ -1,3 +1,4 @@
#pragma once
#include <stdexcept>
#include <sys/types.h>

View File

@ -1,3 +1,4 @@
#pragma once
#include <fstream>
#include <string>
#include <vector>

View File

@ -1,3 +1,4 @@
#pragma once
#include <stdexcept>
#include <sys/types.h>

View File

@ -1,4 +1,5 @@
#include "mappings.hpp"
#include "ansi.hpp"
#include "csv.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
@ -71,16 +72,22 @@ Mappings Mappings::load() {
}
void showMapInfo(Mapping mapping, std::optional<std::string> rename) {
auto doc = mapping.doc.has_value() ? "\n\n\t" + *mapping.doc + "\n" : "";
auto doc = mapping.doc.has_value()
? std::string(ansi::yellow) + "\n\n\t" + *mapping.doc + "\n"
: "";
if (rename.has_value()) {
BOOST_LOG_TRIVIAL(info)
<< "\nFound mapping:\n"
<< "\n\tOriginal\t" << mapping.orig << "\n\tRemapped\t" << mapping.name
<< "\n\tRenamed \t" << *rename << doc;
<< ansi::cyan << "\n\tOriginal\t" << ansi::green << mapping.orig
<< ansi::cyan << "\n\tRemapped\t" << ansi::green << mapping.name
<< ansi::cyan << "\n\tRenamed \t" << ansi::green << *rename << doc
<< ansi::reset;
} else {
BOOST_LOG_TRIVIAL(info) << "\nFound mapping:\n"
<< "\n\tOriginal\t" << mapping.orig
<< "\n\tRemapped\t" << mapping.name << doc;
BOOST_LOG_TRIVIAL(info)
<< "\nFound mapping:\n"
<< ansi::cyan << "\n\tOriginal\t" << ansi::green << mapping.orig
<< ansi::cyan << "\n\tRemapped\t" << ansi::green << mapping.name << doc
<< ansi::reset;
}
}

View File

@ -1,3 +1,4 @@
#pragma once
#include <map>
#include <optional>
#include <string>

View File

@ -1,3 +1,4 @@
#pragma once
#include <string>
namespace resourceloc {
std::string resolve(std::string inp);

View File

@ -1,3 +1,4 @@
#pragma once
#include <stdexcept>
#include <sys/types.h>