File tree Expand file tree Collapse file tree
usr/libexec/helper-scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515# shellcheck disable=SC2034
1616get_colors () {
17+ local color_yes_or_no
18+
1719 get_colors_sourced=1
1820
1921 draw=" " # # Intentionally not implemented, see below
2022
21- if test -n " ${NO_COLOR:- } " || test -n " ${ANSI_COLORS_DISABLED:- } " || \
22- test -z " ${TERM:- } " || test " ${TERM:- } " = " dumb" || test " ${TERM:- } " = " unknown" || \
23- ! test -t 2 || ! test " ${ASSUME_TERM_PRESENT-} " = ' true' ; then
23+ if test -n " ${NO_COLOR:- } " ; then
24+ color_yes_or_no=no
25+ fi
26+ if test -n " ${ANSI_COLORS_DISABLED:- } " ; then
27+ color_yes_or_no=no
28+ fi
29+ if test -z " ${TERM:- } " ; then
30+ color_yes_or_no=no
31+ fi
32+ if test " ${TERM:- } " = " dumb" ; then
33+ color_yes_or_no=no
34+ fi
35+ if test " ${TERM:- } " = " unknown" ; then
36+ color_yes_or_no=no
37+ fi
38+ if ! test -t 2; then
39+ color_yes_or_no=no
40+ fi
41+
42+ # # TODO: Rename to 'COLOR_FORCE_YES=true'?
43+ if test " ${ASSUME_TERM_PRESENT-} " = ' true' ; then
44+ color_yes_or_no=yes
45+ fi
46+
47+ [[ -v color_yes_or_no ]] || color_yes_or_no=" yes"
48+
49+ if test " ${color_yes_or_no} " = " no" ; then
2450 nocolor=" " ; reset=" "
2551 bold=" " ; nobold=" "
2652 underline=" " ; nounderline=" "
You can’t perform that action at this time.
0 commit comments