almost fix return 0
This commit is contained in:
+10
-12
@@ -26,14 +26,14 @@ FG_COLORS[GRAY]='\e[90m'
|
||||
FG_COLORS[MAGENTA]='\e[95m'
|
||||
|
||||
declare -A BG_COLORS
|
||||
BG_COLORS["BLACK"]='\e[40m'
|
||||
BG_COLORS["RED"]='\e[41m'
|
||||
BG_COLORS["GREEN"]='\e[42m'
|
||||
BG_COLORS["YELLOW"]='\e[43m'
|
||||
BG_COLORS["BLUE"]='\e[44m'
|
||||
BG_COLORS["PURPLE"]='\e[45m'
|
||||
BG_COLORS["CYAN"]='\e[46m'
|
||||
BG_COLORS["WHITE"]='\e[47m'
|
||||
BG_COLORS[BLACK]='\e[40m'
|
||||
BG_COLORS[RED]='\e[41m'
|
||||
BG_COLORS[GREEN]='\e[42m'
|
||||
BG_COLORS[YELLOW]='\e[43m'
|
||||
BG_COLORS[BLUE]='\e[44m'
|
||||
BG_COLORS[PURPLE]='\e[45m'
|
||||
BG_COLORS[CYAN]='\e[46m'
|
||||
BG_COLORS[WHITE]='\e[47m'
|
||||
# BG_COLORS["GRAY"]='\e[90m'
|
||||
# BG_COLORS["MAGENTA"]='\e[95m'
|
||||
|
||||
@@ -59,7 +59,6 @@ function style_padding {
|
||||
style_ansi "$left"
|
||||
|
||||
style_ansi "$1"
|
||||
# builtin echo -n "$1"
|
||||
|
||||
right=$(for _ in $(seq 1 "${padding_right}"); do builtin echo -n ' '; done)
|
||||
style_ansi "$right"
|
||||
@@ -75,9 +74,7 @@ function _style_variant {
|
||||
|
||||
function _style_bg {
|
||||
if [[ -n "$1" ]]; then
|
||||
[[ -v BG_COLORS[$1] ]] && echo "${BG_COLORS[$1]}" && return
|
||||
>&2 echo "unknown BG value: $1" && return 1
|
||||
# false
|
||||
[[ -v BG_COLORS[$1] ]] && echo "${BG_COLORS[$1]}" || >&2 echo "unknown BG value: $1"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -93,6 +90,7 @@ function style_ansi {
|
||||
|
||||
function style_block {
|
||||
local content length top bottom i
|
||||
|
||||
content=$(style_padding "$1")
|
||||
length=$(ansi_length "$content")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user