24 lines
390 B
Plaintext
24 lines
390 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
# Colors
|
||
|
|
||
|
COLOR_INFO='\e[0;36m'
|
||
|
COLOR_ERROR='\e[0;31m'
|
||
|
COLOR_WARN='\e[0;33m'
|
||
|
COLOR_SUCCESS='\e[0;32m'
|
||
|
COLOR_DEBUG='\e[0;35m'
|
||
|
|
||
|
function log {
|
||
|
local args=( $@ )
|
||
|
local color=COLOR_${args[0]}
|
||
|
echo -e "${!color}[${args[0]}] $(remove_ansi ${args[@]:1})\e[0m"
|
||
|
}
|
||
|
|
||
|
function remove_ansi {
|
||
|
echo "$@" | sed 's,\x1B\[[0-9;]*[a-zA-Z],,g'
|
||
|
}
|
||
|
|
||
|
if [ $# -ne 0 ]; then
|
||
|
log $@
|
||
|
fi
|