]> git.ipfire.org Git - people/stevee/network.git/commitdiff
Add "network zone list-hooks" command.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Jun 2012 14:43:53 +0000 (14:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Jun 2012 14:43:53 +0000 (14:43 +0000)
functions.cli
man/network-zone.8.in

index a9d8be516127d2c23c24dd2b6a6d487a48fbfc1f..c034fcb584d39bf86aa0163eb7ca3c6bb0e64703 100644 (file)
@@ -252,6 +252,9 @@ function cli_zone() {
                        remove)
                                cli_zone_remove $@
                                ;;
+                       list-hooks)
+                               cli_list_hooks zone $@
+                               ;;
                        ""|*)
                                if [ -n "${action}" ]; then
                                        error "Unrecognized argument: '${action}'"
@@ -265,6 +268,26 @@ function cli_zone() {
        fi
 }
 
+function cli_list_hooks() {
+       local type=${1}
+       shift
+
+       if cli_help_requested $@; then
+               cli_show_man network-zone
+               exit ${EXIT_OK}
+       fi
+
+       local hook_dir=$(hook_dir ${type})
+       local hook
+
+       for hook in ${hook_dir}/*; do
+               hook=$(basename ${hook})
+               if hook_exists ${type} ${hook}; then
+                       echo "${hook}"
+               fi
+       done | sort -u
+}
+
 # Removes a zone either immediately, if it is currently down,
 # or adds a tag that the removal will be done when the zone
 # is brought down the next time.
index 4703386f7785a3e72e7ae0cc1471d05ced205fbf..75633c551c8e91fc8f20cc5c26aec75d125a0fb6 100644 (file)
@@ -4,7 +4,9 @@
 network-zone \- Network Configuration Control Program
 
 .SH SYNOPSIS
-\fBnetwork [OPTIONS] zone create <zone> ...\fR
+\fBnetwork [OPTIONS] zone [create|remove] <zone> ...\fR
+.P
+\fBnetwork [OPTIONS] zone list-hooks\fR
 .P
 \fBnetwork [OPTIONS] zone <zone> command ...\fR
 
@@ -38,6 +40,12 @@ to be remove later, after it has been brought down.
 .RE
 .PP
 
+\fBlist-hooks\fR
+.RS 4
+Outputs a list of all possible hooks for the zones.
+.RE
+.PP
+
 For all other commands, the name of the zone needs to be passed first:
 \fBnetwork zone <zone> command\fR.