main : gracefully exit when invalid params are passed (#1002)

* Refactor whisper_params_parse to return false on failure

* Updated help flag behavior
This commit is contained in:
faker 2023-06-25 18:51:59 +08:00 committed by GitHub
parent 3ec7bfffe0
commit 598f607e28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,8 +148,7 @@ bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
else if (arg == "-f" || arg == "--file") { params.fname_inp.emplace_back(argv[++i]); }
else {
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
whisper_print_usage(argc, argv, params);
exit(0);
return false;
}
}
@ -689,6 +688,7 @@ int main(int argc, char ** argv) {
whisper_params params;
if (whisper_params_parse(argc, argv, params) == false) {
whisper_print_usage(argc, argv, params);
return 1;
}