blob: 3958d90b2489ca4eef7c304d4e7afb5165b16702 (
plain)
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
42
43
44
45
46
47
|
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}"
}
tracknote() {
local str=$1
local msg=$2
_line_count=$((_line_count + 1))
echo " - $2"
}
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"
}
|