only return 0 when using -h (#2738)

This commit is contained in:
Aaron Blasko 2023-07-18 21:00:08 +02:00 committed by GitHub
parent 08310b4af9
commit 7c1dacea09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,6 +49,7 @@ int main(int argc, char** argv) {
} else if (it->compare("-c") == 0 || it->compare("--config") == 0) { } else if (it->compare("-c") == 0 || it->compare("--config") == 0) {
if (std::next(it) == args.end()) { if (std::next(it) == args.end()) {
help(); help();
return 1; return 1;
} }
std::string next_arg = std::next(it)->c_str(); std::string next_arg = std::next(it)->c_str();
@ -66,9 +67,15 @@ int main(int argc, char** argv) {
it++; it++;
continue; continue;
} else { } else if (it->compare("-h") == 0 || it->compare("--help") == 0) {
help(); help();
return 0; return 0;
} else {
std::cerr << "[ ERROR ] Unknown option '" << it->c_str() << "'!\n";
help();
return 1;
} }
} }