28 #include <osg/ArgumentParser> 29 #include <osgDB/FileNameUtils> 37 void ParseCmdLineArgs(
int& argc,
char** argv, std::string& logFileName, std::string& logLevel,
bool &updateVer,
bool &incVer,
int &majVer,
int &minVer, std::string &yymmVer,
int &buildVer)
39 osg::ArgumentParser arguments(&argc, argv);
41 arguments.getApplicationUsage()->setApplicationName(
PROGRAM_NAME);
43 arguments.getApplicationUsage()->addCommandLineOption(
"\n--setBuild ",
"Sets the softwares Build version");
44 arguments.getApplicationUsage()->addCommandLineOption(
"\n--setYYMM ",
"Sets the softwares YYMM version");
45 arguments.getApplicationUsage()->addCommandLineOption(
"\n--setMinor ",
"Sets the softwares Minor version");
46 arguments.getApplicationUsage()->addCommandLineOption(
"\n--setMajor ",
"Sets the softwares Major version");
47 arguments.getApplicationUsage()->addCommandLineOption(
"\n--setVer <Maj> <Min> <YYMM> <Build>",
"Sets the softwares version");
48 arguments.getApplicationUsage()->addCommandLineOption(
"\n--incVer ",
"Increments the softwares version");
49 arguments.getApplicationUsage()->addCommandLineOption(
"\n--updateVer ",
"Update the softwares version using .hg Revision and current YYMM");
50 arguments.getApplicationUsage()->addCommandLineOption(
"\n--logFileName <filename> ",
"The name of the log file to use. Defaults to TrueRealityLog.html");
51 arguments.getApplicationUsage()->addCommandLineOption(
"\n--logLevel <level> ",
"Logging level to use. \nLevel options are: " +
trUtil::Logging::LOG_DEBUG_STR +
", " +
55 arguments.getApplicationUsage()->addCommandLineOption(
"\n--help, /help, -h, /h, /? ",
"Show this help screen.");
57 if (arguments.read(
"--help") ==
true ||
58 arguments.read(
"/help") ==
true ||
59 arguments.read(
"-h") ==
true ||
60 arguments.read(
"/h") ==
true ||
61 arguments.read(
"/?") ==
true)
63 arguments.getApplicationUsage()->write(std::cout);
67 if (arguments.read(
"--updateVer") ==
true)
72 if (arguments.read(
"--incVer") ==
true)
77 arguments.read(
"--logFileName", logFileName);
78 arguments.read(
"--logLevel", logLevel);
80 arguments.read(
"--setBuild", buildVer);
81 arguments.read(
"--setYYMM", yymmVer);
82 arguments.read(
"--setMinor", minVer);
83 arguments.read(
"--setMajor", majVer);
84 arguments.read(
"--setVer", majVer, minVer, yymmVer, buildVer);
static const std::string PROGRAM_NAME
static const std::string LOG_ERROR_STR("Error")
String value for ERROR Logging level.
static const std::string LOG_WARNING_STR("Warning")
String value for WARNING Logging level.
static const std::string LOG_DEBUG_STR("Debug")
String value for DEBUG Logging level.
void ParseCmdLineArgs(int &argc, char **argv, std::string &logFileName, std::string &logLevel, bool &updateVer, bool &incVer, int &majVer, int &minVer, std::string &yymmVer, int &buildVer)
static const std::string LOG_INFO_STR("Info")
String value for INFO Logging level.