From 3bc8266d0e00abb9c1e505aef02fc40328e4c4ec Mon Sep 17 00:00:00 2001 From: devi Date: Mon, 22 Jun 2026 16:09:16 +0530 Subject: [PATCH] Preserve partial command matches over variable errors --- cligen_match.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cligen_match.c b/cligen_match.c index a92e590..ff40e46 100644 --- a/cligen_match.c +++ b/cligen_match.c @@ -512,10 +512,20 @@ match_vec(cligen_handle h, if (mr_pref_get(mr) == COV_PREF_COMMAND_PARTIAL && mr_reason_get(mr) != NULL && pref_lower > COV_PREF_COMMAND_PARTIAL){ - /* Partial command match with a validation error from a variable: - * remove the partial match and keep the validation reason + /* + * Keep partial matches originating from commands/keywords, + * but discard partial matches originating from expanded + * variable values. This preserves command completion and + * execution while still reporting genuine variable + * validation failures. */ - mr_pt_reset(mr); + co = mr_pt_i_get(mr, 0); + if (co && + co->co_ref && + co->co_ref->co_type == CO_VARIABLE) { + /* Partial match came from an expanded variable value. */ + mr_pt_reset(mr); + } } else mr_reason_set(mr, NULL);