summaryrefslogtreecommitdiffstats
path: root/remote/lib/print.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-09-04 22:06:01 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-09-04 22:06:01 +0200
commit6db35a5230578e296d9f493b28e6330e22569c8f (patch)
tree86ccb8725d2ae1a779459e2d8c01087c07a37e58 /remote/lib/print.sh
parent78f3f37d3d8b213887fa6d47e32c5f9f05c0e299 (diff)
downloadconky-6db35a5230578e296d9f493b28e6330e22569c8f.tar.gz
conky-6db35a5230578e296d9f493b28e6330e22569c8f.tar.bz2
conky-6db35a5230578e296d9f493b28e6330e22569c8f.tar.xz
conky-6db35a5230578e296d9f493b28e6330e22569c8f.zip
Integrate also nagios-based monitoring here
Diffstat (limited to 'remote/lib/print.sh')
-rw-r--r--remote/lib/print.sh168
1 files changed, 0 insertions, 168 deletions
diff --git a/remote/lib/print.sh b/remote/lib/print.sh
deleted file mode 100644
index a0fdcbe..0000000
--- a/remote/lib/print.sh
+++ /dev/null
@@ -1,168 +0,0 @@
-# underlines 4;30,... blinking 5:30,...
-# backgrounds: 40,...
-
-declare -A colors=(
- [black]='0;30'
- [red]='0;31'
- [green]='0;32'
- [orange]='0;33'
- [blue]='0;34'
- [purple]='0;35'
- [cyan]='0;36'
- [lightgray]='0;37'
- [gray]='1;30'
- [lightred]='1;31'
- [lightgreen]='1;32'
- [yellow]='1;33'
- [lightblue]='1;34'
- [lightpurple]='1;35'
- [lightcyan]='1;36'
- [white]='1;37'
-)
-
-background=""
-foreground=""
-
-
-
-
-# Fixing color map
-#echo -ne "\e[44m"
-#echo -ne '\x1B[K'
-
-function set_background {
- if [ -n "$background" ]; then
- echo -ne "$background"
- echo -ne '\x1B[K'
- fi
-}
-
-function set_color {
- local color=${1:-""}
- local effect=${2:-""}
-
- c=${colors[$color]}
-
-
- case "$effect" in
- 'u')
- c=$(echo $c | sed -r "s/^0/4/ ; s/^1/1;4/")
- ;;
- esac
-
- [ -n "$color" ] && echo -ne "\033[${c}m"
- set_background
-}
-
-function reset_color {
- echo -ne "\033[0m"
-
- set_background
- [ -n "$foreground" ] && set_color "$foreground"
-}
-
-function finish {
- echo -ne "\033[0m"
- echo
-}
-
-function configure_palete {
- case $1 in
- blue)
- background="\e[1;44m"
- foreground="white"
- ;;
- *)
- # Lightgray and Yellow are almost invisible on white
- colors[yellow]=${colors[orange]}
- colors[white]=${colors[black]}
- colors[lightgray]=${colors[gray]}
- colors[cyan]=${colors[blue]}
- ;;
- esac
-
- set_background
- reset_color
-}
-
-function decorate {
- local output="$1"
- local color=${2:-""}
- local effect=${3:-""}
-
- if [ -n "$color" ]; then
- set_color $color $effect
- echo -ne "${output}"
- reset_color
- else
- echo -ne "$output"
- fi
-}
-
-function eol {
- sed 's/$/\x1B[K/'
-}
-
-function print_eol {
- echo -e '\x1B[K'
-}
-
-
-
-function print {
- local output="$1"
- local color=${2:-""}
- local char_limit=${3:-$fold}
- local line_limit=${4:-0}
-
- local cmd="decorate \"${output}\" \"$color\" | fold -s -w $char_limit"
- [ $line_limit -gt 0 ] && cmd="$cmd | head -n $line_limit"
-
- eval "$cmd" | eol
-}
-
-
-function print_hline {
- local color=${1:-"gray"}
- local cols=${COLUMNS:-$(tput cols)}
-
- decorate $(printf '%*s' $cols '' | tr ' ' -) "$color"
- echo | eol
-}
-
-function print_table {
- # The problem here is that all escapes for colors are treated as normal visible symbols
- sed "s/ ::: /@/g" | column -t -s "@" -o " " | eol
-}
-
-function decorate_table {
- print_hline
- cat -
- print_hline
-}
-
-function print_status {
- local status="$1"
-
- if [[ $status =~ ^.$ ]]; then
- case $status in
- 0)
- decorate "*" "red"
- ;;
- 1)
- decorate "*" "green"
- ;;
- 2)
- decorate "*" "yellow"
- ;;
- *)
- decorate "$status" "red"
- ;;
- esac
- else
- decorate "?" "red"
- fi
- echo -n " "
-}
-
-clear