#!/bin/bash
# cleanup - cleanup functioin handling
set -e
######
# Settings
lib_setting_arrays cleanup_funcs
######
# Functions
cleanup_init() {
trap cleanup_exec EXIT
}
cleanup_add() {
has_args 1 "$@"
list_append cleanup_funcs "$1"
}
cleanup_exec() {
for f in "${cleanup_funcs[@]}"; do
$f
done
}