From e1ae4d6ab3546078a84254b8c48494298ae0ae43 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Mon, 30 Mar 2026 21:16:23 -0400 Subject: [PATCH] Add manual --version option Using ARGP_NO_HELP disables all of the default automatic options including "--version". Manually add the "--version" option. Signed-off-by: Hugo Villeneuve --- src/options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/options.c b/src/options.c index fab192b..22b930f 100644 --- a/src/options.c +++ b/src/options.c @@ -62,6 +62,7 @@ static struct argp_option argp_options[] = { {"host", 's', "host", 0, "MPD server address/hostname", 0}, {"help", 'h', 0, 0, "Give this help list", -1}, {"usage", USAGE_KEY, 0, 0, "Give a short usage message", -1}, + {"version", 'V', 0, 0, "Print program version", 0}, { 0 } }; @@ -116,6 +117,9 @@ parse_opt(int key, char *arg, struct argp_state *state) case 't': decode_int(arg, state, &options.start_delay); break; + case 'V': + printf("%s\n", argp_program_version); + exit(0); case USAGE_KEY: argp_state_help(state, state->out_stream, ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); exit(0); -- 2.47.3