diff --git a/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc b/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc index 1f36ee9d074..639313b72f4 100644 --- a/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc +++ b/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc @@ -136,10 +136,18 @@ export function remove_call(ctx, argv, named) continue; for (let idx in val) { + let orig_idx = idx; if (idx != "" + +idx) { let cur_idx = index(data, idx); if (cur_idx >= 0) idx = cur_idx + 1; + else + idx = null; + } else if (+idx > length(data)) + idx = null; + if (idx == null) { + ctx.invalid_argument('Invalid value: %s', orig_idx); + continue; } data[+idx - 1] = null; } @@ -148,6 +156,8 @@ export function remove_call(ctx, argv, named) if (cur.attribute_allow_empty && !length(cur_obj[name])) delete cur_obj[name]; } + if (length(ctx.result.errors) > 0) + return; call_change_cb(ctx, this, argv, named); return ctx.ok(); }; @@ -249,6 +259,7 @@ function remove_params(orig_params) type: "enum", get_object: val.get_object, attribute: val.attribute ?? name, + no_validate: true, value: param_values, force_helptext: true, };