From ca77af7a9a0d9c09e4c49db94c125af3a053d6cc Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 25 May 2026 16:28:22 +0100 Subject: [PATCH] cli: update opt parsing to allow optional values --- src/cli/opt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/opt.c b/src/cli/opt.c index c5def1930..9b0a15869 100644 --- a/src/cli/opt.c +++ b/src/cli/opt.c @@ -270,7 +270,9 @@ static cli_opt_status_t parse_short(cli_opt *opt, cli_opt_parser *parser) } /* Required argument was not provided */ - if (spec->type == CLI_OPT_TYPE_VALUE && !opt->value) + if (spec->type == CLI_OPT_TYPE_VALUE && + !opt->value && + !(spec->usage & CLI_OPT_USAGE_VALUE_OPTIONAL)) opt->status = CLI_OPT_STATUS_MISSING_VALUE; else opt->status = CLI_OPT_STATUS_OK;