Skip to content

Commit

Permalink
exit with success on --help
Browse files Browse the repository at this point in the history
  • Loading branch information
wkjarosz committed Oct 30, 2023
1 parent 736e7ba commit 22515e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Samplin' Safari

Status: [![Build Status](https://travis-ci.org/wkjarosz/SamplinSafari.svg?branch=master)](https://travis-ci.org/wkjarosz/SamplinSafari)
Master branch:
[![macOS build](https://github.com/wkjarosz/SamplinSafari/actions/workflows/ci-mac.yml/badge.svg?branch=master)](https://github.com/wkjarosz/SamplinSafari/actions/workflows/ci-mac.yml)
[![Linux build](https://github.com/wkjarosz/SamplinSafari/actions/workflows/ci-linux.yml/badge.svg?branch=master)](https://github.com/wkjarosz/SamplinSafari/actions/workflows/ci-linux.yml)
[![Windows build](https://github.com/wkjarosz/SamplinSafari/actions/workflows/ci-windows.yml/badge.svg?branch=master)](https://github.com/wkjarosz/SamplinSafari/actions/workflows/ci-windows.yml)

Samplin' Safari is a research tool to visualize and interactively inspect high-dimensional (quasi) Monte Carlo samplers.

Expand Down
13 changes: 8 additions & 5 deletions gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ int nprocs = -1;
int main(int argc, char **argv)
{
vector<string> args;
bool help = false;
bool help = false;
bool error = false;

#if defined(__APPLE__)
bool launched_from_finder = false;
Expand All @@ -43,7 +44,8 @@ int main(int argc, char **argv)
if (strncmp(argv[i], "-", 1) == 0)
{
cerr << "Invalid argument: \"" << argv[i] << "\"!" << endl;
help = true;
help = true;
error = true;
}
args.push_back(argv[i]);
}
Expand All @@ -52,15 +54,16 @@ int main(int argc, char **argv)
catch (const std::exception &e)
{
cout << "Error: " << e.what() << endl;
help = true;
help = true;
error = true;
}

if (help)
{
cout << "Syntax: " << argv[0] << endl;
cout << "Options:" << endl;
cout << " -h, --help Display this message" << endl;
return -1;
return error ? EXIT_FAILURE : EXIT_SUCCESS;
}

try
Expand All @@ -83,7 +86,7 @@ int main(int argc, char **argv)
catch (const std::runtime_error &e)
{
std::cerr << "Caught a fatal error: " << e.what() << endl;
return -1;
return EXIT_FAILURE;
}

return EXIT_SUCCESS;
Expand Down

0 comments on commit 22515e2

Please sign in to comment.