MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / showHelp

Function showHelp

src/Engine/Options.cpp:342–377  ·  view source on GitHub ↗

* Displays command-line help when appropriate. * @param argc Number of arguments. * @param argv Array of argument strings. */

Source from the content-addressed store, hash-verified

340 * @param argv Array of argument strings.
341 */
342bool showHelp(int argc, char *argv[])
343{
344 std::ostringstream help;
345 help << "OpenXcom v" << OPENXCOM_VERSION_SHORT << std::endl;
346 help << "Usage: openxcom [OPTION]..." << std::endl << std::endl;
347 help << "-data PATH" << std::endl;
348 help << " use PATH as the default Data Folder instead of auto-detecting" << std::endl << std::endl;
349 help << "-user PATH" << std::endl;
350 help << " use PATH as the default User Folder instead of auto-detecting" << std::endl << std::endl;
351 help << "-cfg PATH" << std::endl;
352 help << " use PATH as the default Config Folder instead of auto-detecting" << std::endl << std::endl;
353 help << "-KEY VALUE" << std::endl;
354 help << " set option KEY to VALUE instead of default/loaded value (eg. -displayWidth 640)" << std::endl << std::endl;
355 help << "-help" << std::endl;
356 help << "-?" << std::endl;
357 help << " show command-line help" << std::endl;
358 for (int i = 1; i < argc; ++i)
359 {
360 std::string arg = argv[i];
361 if ((arg[0] == '-' || arg[0] == '/') && arg.length() > 1)
362 {
363 std::string argname;
364 if (arg[1] == '-' && arg.length() > 2)
365 argname = arg.substr(2, arg.length()-1);
366 else
367 argname = arg.substr(1, arg.length()-1);
368 std::transform(argname.begin(), argname.end(), argname.begin(), ::tolower);
369 if (argname == "help" || argname == "?")
370 {
371 std::cout << help.str();
372 return true;
373 }
374 }
375 }
376 return false;
377}
378
379/**
380 * Handles the initialization of setting up default options

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected