MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / CommandLineRun

Function CommandLineRun

src/openrct2/command_line/CommandLine.cpp:530–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528namespace OpenRCT2
529{
530 CommandLine::ExitCode CommandLineRun(const char** argv, int32_t argc)
531 {
532 auto argEnumerator = CommandLineArgEnumerator(argv, argc);
533
534 // Pop process path
535 argEnumerator.TryPop();
536
537 const CommandLineCommand* command = CommandLine::FindCommandFor(CommandLine::kRootCommands, &argEnumerator);
538
539 if (command == nullptr)
540 {
541 return CommandLine::ExitCode::fail;
542 }
543
544 if (command->Options != nullptr)
545 {
546 auto argEnumeratorForOptions = CommandLineArgEnumerator(argEnumerator);
547 if (!CommandLine::ParseOptions(command->Options, &argEnumeratorForOptions))
548 {
549 return CommandLine::ExitCode::fail;
550 }
551 }
552
553 if (command == CommandLine::kRootCommands && command->Func == nullptr)
554 {
555 return CommandLine::HandleCommandDefault();
556 }
557
558 return command->Func(&argEnumerator);
559 }
560} // namespace OpenRCT2

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 4

FindCommandForFunction · 0.85
ParseOptionsFunction · 0.85
TryPopMethod · 0.80

Tested by

no test coverage detected