Commit 3ccb71d0 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-sh-functions: don't use tput -S directly

parent 8205e116
...@@ -59,36 +59,35 @@ check_tty() ...@@ -59,36 +59,35 @@ check_tty()
is_command tput || return is_command tput || return
# FreeBSD does not support tput -S # FreeBSD does not support tput -S
echo | a= tput -S >/dev/null 2>/dev/null || return echo | a= tput -S >/dev/null 2>/dev/null || return
[ -z "$USETTY" ] || return USETTY="tput -S"
export USETTY=1
} }
: ${BLACK:=0} ${RED:=1} ${GREEN:=2} ${YELLOW:=3} ${BLUE:=4} ${MAGENTA:=5} ${CYAN:=6} ${WHITE:=7} : ${BLACK:=0} ${RED:=1} ${GREEN:=2} ${YELLOW:=3} ${BLUE:=4} ${MAGENTA:=5} ${CYAN:=6} ${WHITE:=7}
set_boldcolor() set_boldcolor()
{ {
[ "$USETTY" = "1" ] || return [ -n "$USETTY" ] || return
{ {
echo bold echo bold
echo setaf $1 echo setaf $1
} |tput -S } | $USETTY
} }
set_color() set_color()
{ {
[ "$USETTY" = "1" ] || return [ -n "$USETTY" ] || return
{ {
echo setaf $1 echo setaf $1
} |tput -S } | $USETTY
} }
restore_color() restore_color()
{ {
[ "$USETTY" = "1" ] || return [ -n "$USETTY" ] || return
{ {
echo op; # set Original color Pair. echo op; # set Original color Pair.
echo sgr0; # turn off all special graphics mode (bold in our case). echo sgr0; # turn off all special graphics mode (bold in our case).
} |tput -S } | $USETTY
} }
echover() echover()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment