diff options
Diffstat (limited to 'functions.sh')
-rw-r--r-- | functions.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/functions.sh b/functions.sh new file mode 100644 index 0000000..e943dca --- /dev/null +++ b/functions.sh @@ -0,0 +1,43 @@ +out () { + echo ">>> $@" +} + +log () { + [[ $PLAY_DEBUG > 0 ]] && echo "*** $@" +} + +exp () { + log "Setting envvar '$1' to '$2'" + export $1=$2 +} + +exc () { + cmd="eval" + + if [[ $1 == "-e" ]]; then + cmd="exec" + shift + fi + + if [[ $PLAY_DEBUG > 0 ]]; then + log "Executing (using '$cmd'):" + log "> $@" + + sleep 3 + fi + + $cmd "$@" +} + +EXPORT () { + local name=$1 + shift + + for f in $@; do + eval "$f () { ${name}_${f}; }" + done +} + +inherit () { + source $PLAY_TEMPLATES/$1 +} |