mirror of
https://github.com/openwrt/openwrt.git
synced 2025-04-13 22:23:38 +00:00
cli: extend remove call to allow passing values directly
This simplifies script or API usage of this command to remove values directly without having to calculate the index Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
c166cb9661
commit
37c80e61ee
@ -135,8 +135,14 @@ export function remove_call(ctx, argv, named)
|
||||
if (!data)
|
||||
continue;
|
||||
|
||||
for (let idx in val)
|
||||
for (let idx in val) {
|
||||
if (idx != "" + +idx) {
|
||||
let cur_idx = index(data, idx);
|
||||
if (cur_idx >= 0)
|
||||
idx = cur_idx + 1;
|
||||
}
|
||||
data[+idx - 1] = null;
|
||||
}
|
||||
|
||||
cur_obj[name] = filter(data, (v) => v != null);
|
||||
if (cur.attribute_allow_empty && !length(cur_obj[name]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user