mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-01 12:06:54 -06:00
Merge pull request #629 from atgeirr/add-help-all
Add --help-all option that also prints hidden options.
This commit is contained in:
commit
aa6d11c472
@ -513,7 +513,8 @@ void printParamList_(std::ostream& os, const std::list<std::string>& keyList, bo
|
||||
template <class TypeTag>
|
||||
void printUsage(const std::string& helpPreamble,
|
||||
const std::string& errorMsg = "",
|
||||
std::ostream& os = std::cerr)
|
||||
std::ostream& os = std::cerr,
|
||||
const bool showAll = false)
|
||||
{
|
||||
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
|
||||
|
||||
@ -532,12 +533,15 @@ void printUsage(const std::string& helpPreamble,
|
||||
pInfo.paramName = "h,--help";
|
||||
pInfo.usageString = "Print this help message and exit";
|
||||
printParamUsage_(os, pInfo);
|
||||
pInfo.paramName = "-help-all";
|
||||
pInfo.usageString = "Print all parameters, including obsolete, hidden and deprecated ones.";
|
||||
printParamUsage_(os, pInfo);
|
||||
}
|
||||
|
||||
auto paramIt = ParamsMeta::registry().begin();
|
||||
const auto& paramEndIt = ParamsMeta::registry().end();
|
||||
for (; paramIt != paramEndIt; ++paramIt) {
|
||||
if (!paramIt->second.isHidden)
|
||||
if (showAll || !paramIt->second.isHidden)
|
||||
printParamUsage_(os, paramIt->second);
|
||||
}
|
||||
}
|
||||
@ -693,6 +697,10 @@ std::string parseCommandLineOptions(int argc,
|
||||
printUsage<TypeTag>(helpPreamble, /*errorMsg=*/"", std::cout);
|
||||
return "Help called";
|
||||
}
|
||||
if (std::string("--help-all") == argv[i]) {
|
||||
printUsage<TypeTag>(helpPreamble, /*errorMsg=*/"", std::cout, true);
|
||||
return "Help called";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user