diff options
| author | Aaron Blasko <blaskoazzolaaaron@gmail.com> | 2023-07-18 21:00:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-18 21:00:08 +0200 |
| commit | 7c1dacea09e18ddf74fcb9e0be2debce9c0cf94d (patch) | |
| tree | 0c2f7a166dfd9d89f8c194ac9dafe257a283d849 /src/main.cpp | |
| parent | 08310b4af9ce289180d2b3adef157642379f158e (diff) | |
only return 0 when using -h (#2738)
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index aba5aba3..4fcc611f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,6 +49,7 @@ int main(int argc, char** argv) { } else if (it->compare("-c") == 0 || it->compare("--config") == 0) { if (std::next(it) == args.end()) { help(); + return 1; } std::string next_arg = std::next(it)->c_str(); @@ -66,9 +67,15 @@ int main(int argc, char** argv) { it++; continue; - } else { + } else if (it->compare("-h") == 0 || it->compare("--help") == 0) { help(); + return 0; + } else { + std::cerr << "[ ERROR ] Unknown option '" << it->c_str() << "'!\n"; + help(); + + return 1; } } |
