function hook_dir() {
local type=${1}
- echo "${HOOKS_DIR}/${type}s"
+ if [ -n "${type}" ]; then
+ type="/${type}s"
+ fi
+
+ echo "${HOOKS_DIR}${type}"
}
function hook_exists() {
local type=${1}
local hook=${2}
+ assert isset type
+ assert isset hook
+
local hook_dir=$(hook_dir ${type})
[ -d "${hook_dir}/${hook}" ] && return ${EXIT_ERROR}
local hook=${2}
shift 2
+ assert isset type
+ assert isset hook
+
if ! hook_exists ${type} ${hook}; then
error "Hook '${hook}' does not exist."
return ${EXIT_ERROR}
function config_get_hook() {
local config=${1}
+ assert isset config
+
(
. ${config}
echo "${HOOK}"