The syntax to edit a config is now
network zone upl0 config <id> edit
similar to the syntax if a zone is edited.
The cmd variable is setted to the content of ${1}, because we need the content in this variable if the ${id} is not valid, to print a nice error message.
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/functions/functions.zone | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/functions/functions.zone b/src/functions/functions.zone index 441bf5f..776b63b 100644 --- a/src/functions/functions.zone +++ b/src/functions/functions.zone @@ -556,9 +556,18 @@ zone_config() { zone_config_edit "${zone}" "$@" ;; *) - error "Unrecognized argument: ${cmd}" - cli_usage root-zone-config-subcommands - exit ${EXIT_ERROR} + # Check is we get a valid id + # TODO This could be also a valid hid + local id=${cmd} + + if zone_config_id_is valid ${zone} ${id} && [[ ${1} == "edit" ]]; then + shift 1 + zone_config_edit "${zone}" "${id}""$@" + else + error "Unrecognized argument: ${cmd}" + cli_usage root-zone-config-subcommands + exit ${EXIT_ERROR} + fi ;; esac }