mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use Algorithm to Locate '--version' Option
This commit is contained in:
parent
fca167acfd
commit
ad74de2e1a
@ -509,13 +509,17 @@ namespace Opm
|
|||||||
//
|
//
|
||||||
// the call is intercepted by this function which will print "flow $version"
|
// the call is intercepted by this function which will print "flow $version"
|
||||||
// on stdout and exit(0).
|
// on stdout and exit(0).
|
||||||
void handleVersionCmdLine_(int argc, char** argv) {
|
void handleVersionCmdLine_(int argc, char** argv)
|
||||||
for ( int i = 1; i < argc; ++i )
|
{
|
||||||
|
auto pos = std::find_if(argv, argv + argc,
|
||||||
|
[](const char* arg)
|
||||||
{
|
{
|
||||||
if (std::strcmp(argv[i], "--version") == 0) {
|
return std::strcmp(arg, "--version") == 0;
|
||||||
std::cout << "flow " << moduleVersionName() << std::endl;
|
});
|
||||||
std::exit(EXIT_SUCCESS);
|
|
||||||
}
|
if (pos != argv + argc) {
|
||||||
|
std::cout << "flow " << moduleVersionName() << std::endl;
|
||||||
|
std::exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user