Skip to content

Commit b5f7d65

Browse files
committed
Update: FIX colorize_boolean()
1 parent 1e605e6 commit b5f7d65

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

npm-api.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,19 @@ pad() {
485485
################################
486486
# Colorize boolean values for display
487487
colorize_boolean() {
488-
local value=$1
489-
if [ "$value" = "true" ] || [ "$value" = "Enabled" ] || [ "$value" = https ]; then
490-
echo -e "${COLOR_GREEN}$value${CoR}"
491-
elif [ "$value" = "false" ] || [ "$value" = "Disabled" ] || [ "$value" = http ]; then
492-
echo -e "${COLOR_YELLOW}$value${CoR}"
493-
else
494-
echo -e "${COLOR_RED}$value${CoR}"
495-
fi
488+
local value="$1"
489+
if [ "$value" = "true" ]; then
490+
echo "${COLOR_GREEN}true${CoR}"
491+
elif [ "$value" = "false" ]; then
492+
echo "${COLOR_RED}false${CoR}"
493+
else
494+
# Si la valeur n'est ni true ni false, la convertir en booléen
495+
if [ "$value" = "1" ] || [ "$value" = "yes" ] || [ "$value" = "on" ]; then
496+
echo "${COLOR_GREEN}true${CoR}"
497+
else
498+
echo "${COLOR_RED}false${CoR}"
499+
fi
500+
fi
496501
}
497502

498503
################################

0 commit comments

Comments
 (0)