]> git.ipfire.org Git - people/stevee/network.git/blobdiff - src/functions/functions.hook
Add bash-completion for the network command
[people/stevee/network.git] / src / functions / functions.hook
index 90532973e083dc973ae1b9824cea6b6e001687eb..f8e2b6b5f02a465cd72ad2c3d2cc59f64782d7c8 100644 (file)
@@ -30,6 +30,22 @@ function hook_dir() {
 }
 NETWORK_HOOKS_DIR_ZONES="$(hook_dir zone)"
 
+function hook_list() {
+       local type="${1}"
+       assert isoneof type port zone
+
+       local dir="$(hook_dir "${type}")"
+       assert isset dir
+
+       local hook
+       for hook in ${dir}/*; do
+               hook_exists "${hook}" || continue
+               print "${hook}"
+       done
+
+       return ${EXIT_OK}
+}
+
 function hook_exists() {
        local type=${1}
        local hook=${2}