mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-02-13 11:54:02 +01:00
cli: object-editor: merge named_args into create parameters
Allow callers of edit_create_destroy to pass additional named arguments via info.named_args that get merged into the create command parameters. Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
parent
7fd71f2c74
commit
b8407e6021
1 changed files with 3 additions and 2 deletions
|
|
@ -557,12 +557,13 @@ export function edit_create_destroy(info, node)
|
|||
required: false,
|
||||
};
|
||||
|
||||
let named_args = info.named_args ?? {};
|
||||
let create_params = {};
|
||||
if (info.types) {
|
||||
for (let name, val in info.types)
|
||||
create_params[name] = object_create_params(val.node);
|
||||
create_params[name] = { ...object_create_params(val.node), ...named_args };
|
||||
} else {
|
||||
create_params = object_create_params(info.type.node);
|
||||
create_params = { ...object_create_params(info.type.node), ...named_args };
|
||||
}
|
||||
|
||||
let types_info = info.types ? "(" + join(", ", keys(info.types)) + ")" : info.type.name;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue