Commit 043b1c1b authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Added support for command-line flags to session reader.

parent 29946855
......@@ -264,10 +264,19 @@ namespace Nektar
{
names += "," + cmdIt->second.shortName;
}
desc.add_options()
(names.c_str(), po::value<std::string>(),
cmdIt->second.description.c_str())
;
if (cmdIt->second.isFlag)
{
desc.add_options()
(names.c_str(), cmdIt->second.description.c_str())
;
}
else
{
desc.add_options()
(names.c_str(), po::value<std::string>(),
cmdIt->second.description.c_str())
;
}
}
// List hidden options (e.g. session file arguments are not actually
......
......@@ -69,6 +69,7 @@ namespace Nektar
{
std::string shortName;
std::string description;
bool isFlag;
};
typedef std::map<std::string, CmdLineArg> CmdLineArgMap;
......@@ -377,6 +378,12 @@ namespace Nektar
const std::string &pName,
const std::string &pShortName,
const std::string &pDescription);
/// Registers a command-line flag with the session reader.
LIB_UTILITIES_EXPORT inline static std::string
RegisterCmdLineFlag(
const std::string &pName,
const std::string &pShortName,
const std::string &pDescription);
/// Substitutes expressions defined in the XML document.
LIB_UTILITIES_EXPORT void SubstituteExpressions(std::string &expr);
......@@ -630,6 +637,25 @@ namespace Nektar
CmdLineArg x;
x.shortName = pShortName;
x.description = pDescription;
x.isFlag = false;
m_cmdLineArguments[pName] = x;
return pName;
}
/**
*
*/
inline std::string SessionReader::RegisterCmdLineFlag(
const std::string &pName,
const std::string &pShortName,
const std::string &pDescription)
{
ASSERTL0(!pName.empty(), "Empty name for cmdline argument.");
CmdLineArg x;
x.shortName = pShortName;
x.description = pDescription;
x.isFlag = true;
m_cmdLineArguments[pName] = x;
return pName;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment