Refactor CommandLine parsing and processing

Get rid of fixed list of command arguments and use flexible access to pre-parsed options.
Use command line parsing algorithm from `Flax.Build` that has been battle tested.
Simplify API and expose it to scripting (incl. plugins).
This commit is contained in:
2026-07-21 23:36:32 +02:00
parent d0ab5c961e
commit 05430941dc
9 changed files with 306 additions and 303 deletions
@@ -499,6 +499,28 @@ bool StringUtils::Parse(const char* str, float* result)
#endif
}
bool StringUtils::Parse(const Char* str, int32 length, bool* result)
{
if ((length == 1 && CompareIgnoreCase(str, TEXT("1"), length) == 0) ||
(length == 4 && CompareIgnoreCase(str, TEXT("true"), length) == 0))
{
*result = true;
return false;
}
if ((length == 1 && CompareIgnoreCase(str, TEXT("0"), length) == 0) ||
(length == 5 && CompareIgnoreCase(str, TEXT("false"), length) == 0))
{
*result = false;
return false;
}
return true;
}
String StringUtils::ToString(bool value)
{
return value ? TEXT("true") : TEXT("false");
}
String StringUtils::ToString(int32 value)
{
return String::Format(TEXT("{}"), value);