Added colored text in terminal
This commit is contained in:
27
LXC/LXC.cpp
27
LXC/LXC.cpp
@@ -6,20 +6,25 @@ int main(int argc, char** argv)
|
||||
{
|
||||
using namespace LXC;
|
||||
|
||||
//
|
||||
|
||||
Lexer::LexerContext context;
|
||||
Lexer::Token exampleToken(context, 2);
|
||||
|
||||
//
|
||||
|
||||
// Reads the given file to a string //
|
||||
Util::ReturnVal fileContents = Util::ReadFile("example/example.lx");
|
||||
if (fileContents.Failed())
|
||||
{
|
||||
// Stores the error for easier access //
|
||||
Util::FileReadError& err = fileContents.Error();
|
||||
|
||||
if (fileContents.Suceeded())
|
||||
std::cout << fileContents.Result() << std::endl;
|
||||
// Prints the error to the console //
|
||||
Util::PrintAs<Util::Color::WHITE>("[LXC]");
|
||||
Util::PrintAs<Util::Color::LIGHT_RED>(" Error: ");
|
||||
|
||||
else
|
||||
std::cout << fileContents.Error().reason << " | " << fileContents.Error().path << std::endl;
|
||||
std::cout
|
||||
<< Util::FileReadError::ReasonStr(err.reason) << ' '
|
||||
<< '[' << std::filesystem::absolute(err.path) << ']'
|
||||
<< std::endl;
|
||||
|
||||
// Returns with default exit code //
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user