Skip to content

Commit db5a84b

Browse files
authored
cli : add --version flag (#3878)
Adds a `--version` option to whisper-cli that prints the library version via `whisper_version()` and exits, plus a corresponding entry in the help output. Mirrors the existing `-h`/`--help` handling. Closes #608
1 parent 0ec0845 commit db5a84b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

examples/cli/cli.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ static bool whisper_params_parse(int argc, char ** argv, whisper_params & params
151151
whisper_print_usage(argc, argv, params);
152152
exit(0);
153153
}
154+
if (arg == "--version") {
155+
fprintf(stdout, "whisper.cpp version: %s\n", whisper_version());
156+
exit(0);
157+
}
154158
#define ARGV_NEXT (((i + 1) < argc) ? argv[++i] : requires_value_error(arg))
155159
else if (arg == "-t" || arg == "--threads") { params.n_threads = std::stoi(ARGV_NEXT); }
156160
else if (arg == "-p" || arg == "--processors") { params.n_processors = std::stoi(ARGV_NEXT); }
@@ -234,6 +238,7 @@ static void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params
234238
fprintf(stderr, "\n");
235239
fprintf(stderr, "options:\n");
236240
fprintf(stderr, " -h, --help [default] show this help message and exit\n");
241+
fprintf(stderr, " --version show version information and exit\n");
237242
fprintf(stderr, " -t N, --threads N [%-7d] number of threads to use during computation\n", params.n_threads);
238243
fprintf(stderr, " -p N, --processors N [%-7d] number of processors to use during computation\n", params.n_processors);
239244
fprintf(stderr, " -ot N, --offset-t N [%-7d] time offset in milliseconds\n", params.offset_t_ms);

0 commit comments

Comments
 (0)