From Eric Sokolowski and Robert Osfield, moved command line option usage setup

from osgviewer example into osg::ArgumentParser and osgViewer::Viewer to make
them more universally available.
This commit is contained in:
Robert Osfield
2008-05-12 10:55:55 +00:00
parent 61cb0833b9
commit 965c72f5bd
5 changed files with 46 additions and 17 deletions

View File

@@ -630,3 +630,19 @@ void ArgumentParser::writeErrorMessages(std::ostream& output,ErrorSeverity sever
}
}
}
ApplicationUsage::Type ArgumentParser::readHelpType()
{
getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available");
getApplicationUsage()->addCommandLineOption("--help-keys","Display keyboard & mouse bindings available");
getApplicationUsage()->addCommandLineOption("--help-all","Display all command line, env vars and keyboard & mouse bindings.");
// if user request help write it out to cout.
if (read("--help-all")) return ApplicationUsage::HELP_ALL;
if (read("-h") || read("--help")) return ApplicationUsage::COMMAND_LINE_OPTION;
if (read("--help-env")) return ApplicationUsage::ENVIRONMENTAL_VARIABLE;
if (read("--help-keys")) return ApplicationUsage::KEYBOARD_MOUSE_BINDING;
return ApplicationUsage::NO_HELP;
}