blob: cf3e0203c9e0eaf261b6ff8332678ece8c906318 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#! /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";
}
|