2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-12 11:37:27 +00:00

feat: add command line option to disable color output

This commit is contained in:
Jan Laupetin
2025-09-11 22:39:15 +02:00
parent d693ace12f
commit c28357a19f
5 changed files with 50 additions and 0 deletions

View File

@@ -29,6 +29,12 @@ const CommandLineOption* const OPTION_VERBOSE =
.WithDescription("Outputs a lot more and more detailed messages.") .WithDescription("Outputs a lot more and more detailed messages.")
.Build(); .Build();
const CommandLineOption* const OPTION_NO_COLOR =
CommandLineOption::Builder::Create()
.WithLongName("no-color")
.WithDescription("Disables colored terminal output.")
.Build();
constexpr auto CATEGORY_GAME = "Game"; constexpr auto CATEGORY_GAME = "Game";
const CommandLineOption* const OPTION_GAME_IW3 = const CommandLineOption* const OPTION_GAME_IW3 =
@@ -71,6 +77,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP, OPTION_HELP,
OPTION_VERSION, OPTION_VERSION,
OPTION_VERBOSE, OPTION_VERBOSE,
OPTION_NO_COLOR,
OPTION_GAME_IW3, OPTION_GAME_IW3,
OPTION_GAME_IW4, OPTION_GAME_IW4,
OPTION_GAME_IW5, OPTION_GAME_IW5,
@@ -143,5 +150,8 @@ bool ImageConverterArgs::ParseArgs(const int argc, const char** argv, bool& shou
else else
con::globalLogLevel = con::LogLevel::INFO; con::globalLogLevel = con::LogLevel::INFO;
// --no-color
con::globalUseColor = !m_argument_parser.IsOptionSpecified(OPTION_NO_COLOR);
return true; return true;
} }

View File

@@ -36,6 +36,12 @@ const CommandLineOption* const OPTION_VERBOSE =
.WithDescription("Outputs a lot more and more detailed messages.") .WithDescription("Outputs a lot more and more detailed messages.")
.Build(); .Build();
const CommandLineOption* const OPTION_NO_COLOR =
CommandLineOption::Builder::Create()
.WithLongName("no-color")
.WithDescription("Disables colored terminal output.")
.Build();
const CommandLineOption* const OPTION_BASE_FOLDER = const CommandLineOption* const OPTION_BASE_FOLDER =
CommandLineOption::Builder::Create() CommandLineOption::Builder::Create()
.WithShortName("b") .WithShortName("b")
@@ -116,6 +122,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP, OPTION_HELP,
OPTION_VERSION, OPTION_VERSION,
OPTION_VERBOSE, OPTION_VERBOSE,
OPTION_NO_COLOR,
OPTION_BASE_FOLDER, OPTION_BASE_FOLDER,
OPTION_OUTPUT_FOLDER, OPTION_OUTPUT_FOLDER,
OPTION_ADD_ASSET_SEARCH_PATH, OPTION_ADD_ASSET_SEARCH_PATH,
@@ -200,6 +207,9 @@ bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContin
else else
con::globalLogLevel = con::LogLevel::INFO; con::globalLogLevel = con::LogLevel::INFO;
// --no-color
con::globalUseColor = !m_argument_parser.IsOptionSpecified(OPTION_NO_COLOR);
// b; --base-folder // b; --base-folder
if (m_argument_parser.IsOptionSpecified(OPTION_BASE_FOLDER)) if (m_argument_parser.IsOptionSpecified(OPTION_BASE_FOLDER))
m_base_folder = m_argument_parser.GetValueForOption(OPTION_BASE_FOLDER); m_base_folder = m_argument_parser.GetValueForOption(OPTION_BASE_FOLDER);

View File

@@ -30,6 +30,12 @@ const CommandLineOption* const OPTION_VERBOSE =
.WithDescription("Outputs a lot more and more detailed messages.") .WithDescription("Outputs a lot more and more detailed messages.")
.Build(); .Build();
const CommandLineOption* const OPTION_NO_COLOR =
CommandLineOption::Builder::Create()
.WithLongName("no-color")
.WithDescription("Disables colored terminal output.")
.Build();
const CommandLineOption* const OPTION_OUTPUT_FOLDER = const CommandLineOption* const OPTION_OUTPUT_FOLDER =
CommandLineOption::Builder::Create() CommandLineOption::Builder::Create()
.WithShortName("o") .WithShortName("o")
@@ -59,6 +65,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP, OPTION_HELP,
OPTION_VERSION, OPTION_VERSION,
OPTION_VERBOSE, OPTION_VERBOSE,
OPTION_NO_COLOR,
OPTION_OUTPUT_FOLDER, OPTION_OUTPUT_FOLDER,
OPTION_BUILD_LOG, OPTION_BUILD_LOG,
OPTION_DEFINE, OPTION_DEFINE,
@@ -124,6 +131,9 @@ bool RawTemplaterArguments::ParseArgs(const int argc, const char** argv, bool& s
else else
con::globalLogLevel = con::LogLevel::INFO; con::globalLogLevel = con::LogLevel::INFO;
// --no-color
con::globalUseColor = !m_argument_parser.IsOptionSpecified(OPTION_NO_COLOR);
// -o; --output // -o; --output
if (m_argument_parser.IsOptionSpecified(OPTION_OUTPUT_FOLDER)) if (m_argument_parser.IsOptionSpecified(OPTION_OUTPUT_FOLDER))
m_output_directory = m_argument_parser.GetValueForOption(OPTION_OUTPUT_FOLDER); m_output_directory = m_argument_parser.GetValueForOption(OPTION_OUTPUT_FOLDER);

View File

@@ -34,6 +34,12 @@ const CommandLineOption* const OPTION_VERBOSE =
.WithDescription("Outputs a lot more and more detailed messages.") .WithDescription("Outputs a lot more and more detailed messages.")
.Build(); .Build();
const CommandLineOption* const OPTION_NO_COLOR =
CommandLineOption::Builder::Create()
.WithLongName("no-color")
.WithDescription("Disables colored terminal output.")
.Build();
const CommandLineOption* const OPTION_MINIMAL_ZONE_FILE = const CommandLineOption* const OPTION_MINIMAL_ZONE_FILE =
CommandLineOption::Builder::Create() CommandLineOption::Builder::Create()
.WithShortName("min") .WithShortName("min")
@@ -125,6 +131,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP, OPTION_HELP,
OPTION_VERSION, OPTION_VERSION,
OPTION_VERBOSE, OPTION_VERBOSE,
OPTION_NO_COLOR,
OPTION_MINIMAL_ZONE_FILE, OPTION_MINIMAL_ZONE_FILE,
OPTION_LOAD, OPTION_LOAD,
OPTION_LIST, OPTION_LIST,
@@ -300,6 +307,9 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldCont
else else
con::globalLogLevel = con::LogLevel::INFO; con::globalLogLevel = con::LogLevel::INFO;
// --no-color
con::globalUseColor = !m_argument_parser.IsOptionSpecified(OPTION_NO_COLOR);
// -min; --minimal-zone // -min; --minimal-zone
m_minimal_zone_def = m_argument_parser.IsOptionSpecified(OPTION_MINIMAL_ZONE_FILE); m_minimal_zone_def = m_argument_parser.IsOptionSpecified(OPTION_MINIMAL_ZONE_FILE);

View File

@@ -30,6 +30,12 @@ const CommandLineOption* const OPTION_VERBOSE =
.WithDescription("Outputs a lot more and more detailed messages.") .WithDescription("Outputs a lot more and more detailed messages.")
.Build(); .Build();
const CommandLineOption* const OPTION_NO_COLOR =
CommandLineOption::Builder::Create()
.WithLongName("no-color")
.WithDescription("Disables colored terminal output.")
.Build();
constexpr auto CATEGORY_INPUT = "Input"; constexpr auto CATEGORY_INPUT = "Input";
const CommandLineOption* const OPTION_HEADER = const CommandLineOption* const OPTION_HEADER =
@@ -87,6 +93,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP, OPTION_HELP,
OPTION_VERSION, OPTION_VERSION,
OPTION_VERBOSE, OPTION_VERBOSE,
OPTION_NO_COLOR,
OPTION_HEADER, OPTION_HEADER,
OPTION_COMMANDS_FILE, OPTION_COMMANDS_FILE,
OPTION_OUTPUT_FOLDER, OPTION_OUTPUT_FOLDER,
@@ -170,6 +177,9 @@ bool ZoneCodeGeneratorArguments::ParseArgs(const int argc, const char** argv, bo
else else
con::globalLogLevel = con::LogLevel::INFO; con::globalLogLevel = con::LogLevel::INFO;
// --no-color
con::globalUseColor = !m_argument_parser.IsOptionSpecified(OPTION_NO_COLOR);
// -p; --print // -p; --print
if (m_argument_parser.IsOptionSpecified(OPTION_PRINT)) if (m_argument_parser.IsOptionSpecified(OPTION_PRINT))
m_task_flags |= FLAG_TASK_PRINT; m_task_flags |= FLAG_TASK_PRINT;