]> git.ipfire.org Git - people/jschlag/network.git/commitdiff
zone: change edit syntax for config.
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 5 Jul 2017 14:19:52 +0000 (16:19 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 Jul 2017 15:14:10 +0000 (17:14 +0200)
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>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.zone

index 441bf5f8b21945b6e34fd4903fbd65a90f66e22f..776b63b0144d5a2234eb9b53badceeb5e56248f6 100644 (file)
@@ -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
 }