diff options
author | iximeow <me@iximeow.net> | 2015-11-04 23:59:29 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2015-11-04 23:59:29 -0800 |
commit | 4b4b3b9a15404263a537e8202a5085e942c57a7f (patch) | |
tree | e6474781bbfba8134cc0b788a298e168f39e57e6 | |
parent | 07ffde953d55e1090220f306a693e8ac1a48f4d8 (diff) |
add progressiflyiosh
-rw-r--r-- | build_helpers/progressif.ly.io.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/build_helpers/progressif.ly.io.sh b/build_helpers/progressif.ly.io.sh new file mode 100644 index 0000000..b163945 --- /dev/null +++ b/build_helpers/progressif.ly.io.sh @@ -0,0 +1,40 @@ +declare -A _LINENOS + +_line_count=0 + +bold_green="\033[32;1m" +bold_red="\033[31;1m" +yellow="\033[33m" +reset_font="\033[00m" + +track() { + local str=$1 + local desc=$2 + local state='*' + _LINENOS[${str}]=$_line_count + _line_count=$((_line_count + 1)) + echo "[${state}] ${desc}" +} + +trackend() { + local str=$1 + local state=$2 + local color='' + if [ "x${state}" = "xt" ]; then + state='+' + color="${bold_green}" + elif [ "x${state}" = "xf" ]; then + state='-' + color="${bold_red}" + else + state='?' + color="${yellow}" + fi + + local orig_line=${_LINENOS[${str}]} + local ret_amount=$((_line_count - orig_line)) + + echo -en "\033[s" + echo -en "\033[${ret_amount}F\033[1C${color}${state}${reset_font}" + echo -en "\033[u" +} |