summaryrefslogtreecommitdiff
path: root/src/lib/common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/common.sh')
-rw-r--r--src/lib/common.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/common.sh b/src/lib/common.sh
index f977726..1fe396c 100644
--- a/src/lib/common.sh
+++ b/src/lib/common.sh
@@ -53,6 +53,30 @@ stat_done() {
printf "${BOLD}done${ALL_OFF}\n" >&2
}
+msg_success() {
+ local msg=$1
+ local padding
+ padding=$(echo "${msg}"|sed -E 's/( *).*/\1/')
+ msg=$(echo "${msg}"|sed -E 's/ *(.*)/\1/')
+ printf "%s %s\n" "${padding}${GREEN}✓${ALL_OFF}" "${msg}" >&2
+}
+
+msg_error() {
+ local msg=$1
+ local padding
+ padding=$(echo "${msg}"|sed -E 's/( *).*/\1/')
+ msg=$(echo "${msg}"|sed -E 's/ *(.*)/\1/')
+ printf "%s %s\n" "${padding}${RED}x${ALL_OFF}" "${msg}" >&2
+}
+
+msg_warn() {
+ local msg=$1
+ local padding
+ padding=$(echo "${msg}"|sed -E 's/( *).*/\1/')
+ msg=$(echo "${msg}"|sed -E 's/ *(.*)/\1/')
+ printf "%s %s\n" "${padding}${YELLOW}!${ALL_OFF}" "${msg}" >&2
+}
+
_setup_workdir=false
setup_workdir() {
[[ -z ${WORKDIR:-} ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX")