Actualizar 'src/status_github.sh'
This commit is contained in:
parent
1d9b60a641
commit
d0af778f56
@ -1,20 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
color_cyan=$(tput setaf 6)
|
||||
color_purple=$(tput setaf 5)
|
||||
color_green=$(tput setaf 2)
|
||||
color_orange=$(tput setaf 3)
|
||||
color_yellow=$(tput setaf 4)
|
||||
color_red=$(tput setaf 1)
|
||||
color_reset=$(tput sgr0)
|
||||
|
||||
translate_state() {
|
||||
case $1 in
|
||||
"operational") echo "operativo" ;;
|
||||
"partial_outage") echo "interrupción parcial" ;;
|
||||
"maintenance") echo "mantenimiento" ;;
|
||||
"major_outage") echo "interrupción importante" ;;
|
||||
"operational") echo "${color_green}operativo${color_reset}" ;;
|
||||
"partial_outage") echo "${color_orange}interrupción parcial${color_reset}" ;;
|
||||
"maintenance") echo "${color_yellow}mantenimiento${color_reset}" ;;
|
||||
"major_outage") echo "${color_red}interrupción importante${color_reset}" ;;
|
||||
*) echo "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
curl -s https://www.githubstatus.com/api/v2/components.json | jq -r '.components[] | "\(.name),\(.status)"' | \
|
||||
curl -s https://www.githubstatus.com/api/v2/components.json | \
|
||||
jq -r '.components[] | "\(.name),\(.status)"' | \
|
||||
while IFS=',' read -r component state; do
|
||||
component=$(echo "$component" | sed "s/'//g")
|
||||
state=$(echo "$state" | sed "s/'//g")
|
||||
@ -22,5 +26,5 @@ while IFS=',' read -r component state; do
|
||||
continue
|
||||
fi
|
||||
state=$(translate_state "$state")
|
||||
printf ' - %s%s%s está %s%s%s.\n' "$color_cyan" "$component" "$color_reset" "$color_purple" "$state" "$color_reset"
|
||||
printf ' - %s%s%s está %s.\n' "$color_cyan" "$component" "$color_reset" "$state"
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user