mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
tools/install: Add support termcap-based tput
This commit is contained in:
@ -3,16 +3,16 @@
|
|||||||
main() {
|
main() {
|
||||||
# Use colors, but only if connected to a terminal, and that terminal
|
# Use colors, but only if connected to a terminal, and that terminal
|
||||||
# supports them.
|
# supports them.
|
||||||
if which tput >/dev/null 2>&1; then
|
if hash tput >/dev/null 2>&1; then
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors 2>/dev/null || tput Co 2>/dev/null || echo -1)
|
||||||
fi
|
fi
|
||||||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
RED="$(tput setaf 1)"
|
RED=$(tput setaf 1 2>/dev/null || tput AF 1 2>/dev/null)
|
||||||
GREEN="$(tput setaf 2)"
|
GREEN=$(tput setaf 2 2>/dev/null || tput AF 2 2>/dev/null)
|
||||||
YELLOW="$(tput setaf 3)"
|
YELLOW=$(tput setaf 3 2>/dev/null || tput AF 3 2>/dev/null)
|
||||||
BLUE="$(tput setaf 4)"
|
BLUE=$(tput setaf 4 2>/dev/null || tput AF 4 2>/dev/null)
|
||||||
BOLD="$(tput bold)"
|
BOLD=$(tput bold 2>/dev/null || tput md 2>/dev/null)
|
||||||
NORMAL="$(tput sgr0)"
|
NORMAL=$(tput sgr0 2>/dev/null || tput me 2>/dev/null)
|
||||||
else
|
else
|
||||||
RED=""
|
RED=""
|
||||||
GREEN=""
|
GREEN=""
|
||||||
|
Reference in New Issue
Block a user