chore: give all args to arg parser instead of omitting arg0

This commit is contained in:
Jan 2024-09-23 22:38:18 +02:00
parent 2b1c048a4a
commit 32480a75eb
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
7 changed files with 12 additions and 6 deletions

View File

@ -73,7 +73,7 @@ void ImageConverterArgs::SetVerbose(const bool isVerbose)
bool ImageConverterArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
if (!m_argument_parser.ParseArguments(argc, argv))
{
PrintUsage();
return false;

View File

@ -245,7 +245,7 @@ std::set<std::string> LinkerArgs::GetSearchPathsForProject(const std::set<std::s
bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
if (!m_argument_parser.ParseArguments(argc, argv))
{
PrintUsage();
return false;

View File

@ -89,7 +89,7 @@ void RawTemplaterArguments::PrintVersion()
bool RawTemplaterArguments::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
if (!m_argument_parser.ParseArguments(argc, argv))
{
PrintUsage();
return false;

View File

@ -265,7 +265,7 @@ void UnlinkerArgs::ParseCommaSeparatedAssetTypeString(const std::string& input)
bool UnlinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
if (!m_argument_parser.ParseArguments(argc, argv))
{
PrintUsage();
return false;

View File

@ -33,8 +33,13 @@ bool ArgumentParser::ParseArguments(std::vector<std::string>& args)
m_matched_arguments.clear();
m_matched_options.clear();
if (args.empty())
return false;
m_path = args[0];
const auto argCount = args.size();
for (unsigned argIndex = 0; argIndex < argCount; argIndex++)
for (unsigned argIndex = 1u; argIndex < argCount; argIndex++)
{
auto& arg = args[argIndex];

View File

@ -23,4 +23,5 @@ private:
std::vector<const CommandLineOption*> m_command_line_options;
std::map<const CommandLineOption*, std::vector<std::string>> m_matched_options;
std::vector<std::string> m_matched_arguments;
std::string m_path;
};

View File

@ -138,7 +138,7 @@ void ZoneCodeGeneratorArguments::PrintVersion()
bool ZoneCodeGeneratorArguments::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
if (!m_argument_parser.ParseArguments(argc, argv))
{
PrintUsage();
return false;