chore: use std format for linker and unlinker args

This commit is contained in:
Jan 2024-10-20 16:23:42 +02:00
parent 3803ae24f5
commit fd421c4784
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
3 changed files with 11 additions and 12 deletions

View File

@ -46,7 +46,7 @@ const CommandLineOption* const OPTION_BASE_FOLDER =
const CommandLineOption* const OPTION_OUTPUT_FOLDER =
CommandLineOption::Builder::Create()
.WithLongName("output-folder")
.WithDescription("Specifies the output folder containing the build artifacts. Defaults to \"" + std::string(LinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\".")
.WithDescription(std::format("Specifies the output folder containing the build artifacts. Defaults to \"{}\".", LinkerArgs::DEFAULT_OUTPUT_FOLDER))
.WithParameter("outputFolderPath")
.Build();
@ -61,14 +61,14 @@ const CommandLineOption* const OPTION_ADD_ASSET_SEARCH_PATH =
const CommandLineOption* const OPTION_ASSET_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("asset-search-path")
.WithDescription("Specifies the search paths used for assets. Defaults to \"" + std::string(LinkerArgs::DEFAULT_ASSET_SEARCH_PATH) + "\".")
.WithDescription(std::format("Specifies the search paths used for assets. Defaults to \"{}\".", LinkerArgs::DEFAULT_ASSET_SEARCH_PATH))
.WithParameter("assetSearchPathString")
.Build();
const CommandLineOption* const OPTION_GDT_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("gdt-search-path")
.WithDescription("Specifies the search paths used for gdt files. Defaults to \"" + std::string(LinkerArgs::DEFAULT_GDT_SEARCH_PATH) + "\".")
.WithDescription(std::format("Specifies the search paths used for gdt files. Defaults to \"{}\".", LinkerArgs::DEFAULT_GDT_SEARCH_PATH))
.WithParameter("gdtSearchPathString")
.Build();
@ -83,7 +83,7 @@ const CommandLineOption* const OPTION_ADD_SOURCE_SEARCH_PATH =
const CommandLineOption* const OPTION_SOURCE_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("source-search-path")
.WithDescription("Specifies the search paths used for source files. Defaults to \"" + std::string(LinkerArgs::DEFAULT_SOURCE_SEARCH_PATH) + "\".")
.WithDescription(std::format("Specifies the search paths used for source files. Defaults to \"{}\".", LinkerArgs::DEFAULT_SOURCE_SEARCH_PATH))
.WithParameter("sourceSearchPathString")
.Build();

View File

@ -59,8 +59,7 @@ const CommandLineOption* const OPTION_OUTPUT_FOLDER =
CommandLineOption::Builder::Create()
.WithShortName("o")
.WithLongName("output-folder")
.WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \""
+ std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"")
.WithDescription(std::format("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"{}\"", UnlinkerArgs::DEFAULT_OUTPUT_FOLDER))
.WithParameter("outputFolderPath")
.Build();
@ -178,7 +177,7 @@ void UnlinkerArgs::SetVerbose(const bool isVerbose)
ObjWriting::Configuration.Verbose = isVerbose;
}
bool UnlinkerArgs::SetImageDumpingMode()
bool UnlinkerArgs::SetImageDumpingMode() const
{
auto specifiedValue = m_argument_parser.GetValueForOption(OPTION_IMAGE_FORMAT);
utils::MakeStringLowerCase(specifiedValue);
@ -196,11 +195,11 @@ bool UnlinkerArgs::SetImageDumpingMode()
}
const std::string originalValue = m_argument_parser.GetValueForOption(OPTION_IMAGE_FORMAT);
printf("Illegal value: \"%s\" is not a valid image output format. Use -? to see usage information.\n", originalValue.c_str());
std::cerr << std::format("Illegal value: \"{}\" is not a valid image output format. Use -? to see usage information.\n", originalValue);
return false;
}
bool UnlinkerArgs::SetModelDumpingMode()
bool UnlinkerArgs::SetModelDumpingMode() const
{
auto specifiedValue = m_argument_parser.GetValueForOption(OPTION_MODEL_FORMAT);
utils::MakeStringLowerCase(specifiedValue);
@ -230,7 +229,7 @@ bool UnlinkerArgs::SetModelDumpingMode()
}
const std::string originalValue = m_argument_parser.GetValueForOption(OPTION_MODEL_FORMAT);
printf("Illegal value: \"%s\" is not a valid model output format. Use -? to see usage information.\n", originalValue.c_str());
std::cerr << std::format("Illegal value: \"{}\" is not a valid model output format. Use -? to see usage information.\n", originalValue);
return false;
}

View File

@ -24,8 +24,8 @@ private:
static void PrintVersion();
void SetVerbose(bool isVerbose);
bool SetImageDumpingMode();
bool SetModelDumpingMode();
bool SetImageDumpingMode() const;
bool SetModelDumpingMode() const;
void AddSpecifiedAssetType(std::string value);
void ParseCommaSeparatedAssetTypeString(const std::string& input);