Skip to content

Commit

Permalink
Update usage string in the help message to fix gh-23
Browse files Browse the repository at this point in the history
  • Loading branch information
st3w committed Oct 8, 2022
1 parent 754618b commit 6ba93ac
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/neo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,12 @@ void PrintVersion() {
exit(0);
}

void PrintHelp(bool bErr) {
void PrintHelp(bool bErr, const char* appName) {
FILE* f = bErr ? stderr : stdout;
fprintf(f, "Usage: neo [OPTIONS]\n");
if (!appName || appName[0] == '\0')
appName = "neo";

fprintf(f, "Usage: %s [OPTIONS]\n", appName);
fprintf(f, "\n");
fprintf(f, "Simulate the digital rain from \"The Matrix\"\n");
fprintf(f, "\n");
Expand Down Expand Up @@ -651,7 +654,7 @@ void ParseArgs(int argc, char* argv[], Cloud* pCloud, double* targetFPS, bool* p
}
case 'h':
Cleanup();
PrintHelp(false);
PrintHelp(false, argv[0]);
break;
case 'l': {
char* nextStr;
Expand Down Expand Up @@ -750,7 +753,7 @@ void ParseArgs(int argc, char* argv[], Cloud* pCloud, double* targetFPS, bool* p
} else {
fprintf(stderr, "Bad command line option\n");
}
PrintHelp(true);
PrintHelp(true, argv[0]);
break;
}
}
Expand Down

0 comments on commit 6ba93ac

Please sign in to comment.