mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -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>
|
template <class TypeTag>
|
||||||
void printUsage(const std::string& helpPreamble,
|
void printUsage(const std::string& helpPreamble,
|
||||||
const std::string& errorMsg = "",
|
const std::string& errorMsg = "",
|
||||||
std::ostream& os = std::cerr)
|
std::ostream& os = std::cerr,
|
||||||
|
const bool showAll = false)
|
||||||
{
|
{
|
||||||
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
|
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
|
||||||
|
|
||||||
@ -532,12 +533,15 @@ void printUsage(const std::string& helpPreamble,
|
|||||||
pInfo.paramName = "h,--help";
|
pInfo.paramName = "h,--help";
|
||||||
pInfo.usageString = "Print this help message and exit";
|
pInfo.usageString = "Print this help message and exit";
|
||||||
printParamUsage_(os, pInfo);
|
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();
|
auto paramIt = ParamsMeta::registry().begin();
|
||||||
const auto& paramEndIt = ParamsMeta::registry().end();
|
const auto& paramEndIt = ParamsMeta::registry().end();
|
||||||
for (; paramIt != paramEndIt; ++paramIt) {
|
for (; paramIt != paramEndIt; ++paramIt) {
|
||||||
if (!paramIt->second.isHidden)
|
if (showAll || !paramIt->second.isHidden)
|
||||||
printParamUsage_(os, paramIt->second);
|
printParamUsage_(os, paramIt->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -693,6 +697,10 @@ std::string parseCommandLineOptions(int argc,
|
|||||||
printUsage<TypeTag>(helpPreamble, /*errorMsg=*/"", std::cout);
|
printUsage<TypeTag>(helpPreamble, /*errorMsg=*/"", std::cout);
|
||||||
return "Help called";
|
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