#! /usr/bin/env dash # shellcheck disable=SC2059,SC2066 out() { printf "$1 $2\n" "$(out2 "$@")"; } out2() { shift 2; for i in "$*";do printf "$i";done; } if [ "$noColor" = "yes" ];then error() { >&2 out "==> ERROR:" "$*"; } >&2 warning() { >&2 out "==> WARNING:" "$*"; } >&2 msg() { out "==>" "$*"; } msg2() { out " ->" "$*"; } readp() { printf "..> $1"; read -r "$2"; } else error() { >&2 out "\033[1;91m==> ERROR:\033[0m" "\033[1;93m$*\033[0m"; } >&2 warning() { >&2 out "\033[1;91m==> WARNING:\033[0m" "\033[1;93m$*\033[0m"; } >&2 msg() { out "\033[1;96m==>\033[0m" "\033[1;93m$*\033[0m"; } msg2() { out "\033[1;96m ->\033[0m" "\033[1;93m$*\033[0m"; } readp() { printf "\033[1;96m..>\033[0m \033[1;93m$1\033[0m"; read -r "$2"; } fi dien() { error "$@" "failed"; exit 1; } die() { error "$@"; exit 1; } clean() { awk '{if (NF) {if (!/^#/) {if (!/^[[:blank:]]*#/) {print $0}}}}' "$1"; } # shellcheck disable=SC2294 tmp() { [ -d /tmp/LIB_FILE_TEMP_DIR/ ] || mkdir /tmp/LIB_FILE_TEMP_DIR/ tmp=$(mktemp -p /tmp/LIB_FILE_TEMP_DIR/); eval "$@" 1> "$tmp"; echo "$tmp"; }