]> git.ipfire.org Git - people/arne_f/network.git/commitdiff
network: Add help for zone command.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Jun 2010 23:37:45 +0000 (01:37 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Jun 2010 23:37:45 +0000 (01:37 +0200)
functions.cli

index 21bb3c5229e9c09a9a07bac535652fd2def6d18a..3c8bccef816c6f9f94dd22e1c06149599973aa37 100644 (file)
@@ -148,6 +148,11 @@ function cli_device_discover() {
 }
 
 function cli_zone() {
+       if cli_help_requested $@; then
+               cli_usage root-zone
+               exit ${EXIT_OK}
+       fi
+
        local action
        local zone
 
@@ -160,6 +165,11 @@ function cli_zone() {
                        config|down|edit|port|show|status|up)
                                zone_${action} ${zone} $@
                                ;;
+                       *)
+                               error "Unrecognized argument: ${action}"
+                               cli_usage root-zone-subcommands
+                               exit ${EXIT_ERROR}
+                               ;;
                esac
        else
                action=${1}
@@ -169,8 +179,14 @@ function cli_zone() {
                        create|remove)
                                zone_${action} $@
                                ;;
-                       *)
-                               error "Unrecognized argument: '${action}'"
+                       ""|*)
+                               if [ -n "${action}" ]; then
+                                       error "Unrecognized argument: '${action}'"
+                                       echo
+                               fi
+
+                               cli_usage root-zone
+                               exit ${EXIT_ERROR}
                                ;;
                esac
        fi
@@ -279,6 +295,24 @@ function cli_usage() {
                        echo    "    be processed."
                        echo
                        ;;
+               root-zone)
+                       echo    "${0}: ${what#root-} <create|remove> <zone> [<type> <options...>]"
+                       echo
+                       echo    "  Create or remove a zone."
+                       echo
+                       echo -e "    ${BOLD}create <zone> <type> <options>${NORMAL}"
+                       echo    "    Create a new zone of type <type> where <zone> is an allowed"
+                       echo    "    zone name."
+                       echo
+                       echo -e "    ${BOLD}remove <zone>${NORMAL}"
+                       echo    "    Remove the zone <zone>."
+                       echo
+                       echo    "  You may also edit the configuration of the zones."
+                       echo
+                       echo -e "    ${BOLD}<zone> ...${NORMAL}"
+                       echo    "    Edit the zone <zone>."
+                       echo
+                       ;;
                usage)
                        echo
                        echo "  Run '${0} help' to get information how to use this tool."