Enforce token presence for multiple_token in json schema

This commit is contained in:
debing.sun 2025-08-05 22:09:25 +08:00
parent ff2f0b092c
commit 4a2e021e9e
2 changed files with 2 additions and 0 deletions

View file

@ -1163,6 +1163,7 @@ static sds addHintForRepeatedArgument(sds hint, cliCommandArg *arg) {
hint = sdscat(hint, "[");
if (arg->flags & CMD_ARG_MULTIPLE_TOKEN) {
assert(arg->token);
hint = sdscat_orempty(hint, arg->token);
if (arg->type != ARG_TYPE_PURE_TOKEN) {
hint = sdscat(hint, " ");

View file

@ -207,6 +207,7 @@ class Argument(object):
s += "CMD_ARG_MULTIPLE|"
if self.desc.get("multiple_token", False):
assert self.desc.get("multiple", False) # Sanity
assert self.desc.get("token", None)
s += "CMD_ARG_MULTIPLE_TOKEN|"
return s[:-1] if s else "CMD_ARG_NONE"