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 <stdexcept>
#include <sys/types.h> #include <sys/types.h>

View file

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

View file

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

View file

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

View file

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

View file

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