X-Git-Url: https://pd.if.org/git/?p=startuptools;a=blobdiff_plain;f=scripts%2Ffunctions.rc;h=854a56735c3e1af787a09b41f95eeaf6ee2db962;hp=fb2b6d9353f261cd20e08ec70628679563384390;hb=d9f823e06902b93c9a708bf831128fe0f4d8d5a3;hpb=24739081c80609ad45ba78147e2b55cddf7c29a2 diff --git a/scripts/functions.rc b/scripts/functions.rc index fb2b6d9..854a567 100644 --- a/scripts/functions.rc +++ b/scripts/functions.rc @@ -1,3 +1,15 @@ +#!/bin/sh + +if [ "$USE_COLOR" = '1' ] && [ -x /usr/bin/tput ]; then +red=$(tput setaf 1) +green=$(tput setaf 2) +off=$(tput sgr0) +fi + +status_msg() { + echo "\r[$1]" +} + status_starting() { echo -n "[ ] Starting $1" } @@ -11,7 +23,7 @@ status_stopping() { } status_ok() { - echo "\r[ OK ]" + echo "\r[ ${green}OK$off ]" } status_fail() { @@ -21,3 +33,8 @@ status_fail() { status_check() { test $? -eq 0 && status_ok || status_fail } + +is_true() { + [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] || [ "$1" = "y" ] || + [ "$1" = "t" ] +}