Update usage

This commit is contained in:
Roman Ožana 2023-11-21 18:24:17 +01:00
parent da0c78a715
commit 8deb6830e7

View File

@ -2,7 +2,17 @@
source colors.sh source colors.sh
echo "-----------------------------------------------------------------------------" # Basic colors
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}\n\n\n"
echo -e " ${BLACK}BLACK${NC}, ${GRAY}GRAY${NC} or ${WHITE}WHITE${NC} color text"
echo -e " ${RED}RED${NC} or ${BRIGHT_RED}BRIGHT_RED${NC} color text"
echo -e " ${GREEN}GREEN${NC} or ${BRIGHT_GREEN}BRIGHT_GREEN${NC} color text"
echo -e " ${BLUE}BLUE${NC} or ${BRIGHT_BLUE}BRIGHT_BLUE${NC} color text"
echo -e " ${YELLOW}YELLOW${NC} or ${BRIGHT_YELLOW}BRIGHT_YELLOW${NC} color text"
echo -e " ${MAGENTA}MAGENTA${NC} or ${BRIGHT_MAGENTA}BRIGHT_MAGENTA${NC} color text"
echo -e " ${CYAN}CYAN${NC} or ${BRIGHT_CYAN}BRIGHT_CYAN${NC} color text"
echo -e "\n\n\n${GRAY}-----------------------------------------------------------------------------${NC}"
# there can be a function that uses the colors # there can be a function that uses the colors
function info() { printf "${BOLD_CYAN}%s${NC}\n" "$@"; } function info() { printf "${BOLD_CYAN}%s${NC}\n" "$@"; }
@ -16,7 +26,6 @@ warn "[WARN] This is warn text"
error "[ERROR] This is error text" error "[ERROR] This is error text"
debug "[DEBUG] This is debug text" debug "[DEBUG] This is debug text"
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}" echo -e "${GRAY}-----------------------------------------------------------------------------${NC}"
## Color print function ## Color print function
@ -28,25 +37,6 @@ color "$BOLD_YELLOW" "Bold yellow text"
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}" echo -e "${GRAY}-----------------------------------------------------------------------------${NC}"
echo -e "${BLACK}Black color text${NC}"
echo -e "${WHITE}White color text${NC}"
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}\n\n"
# Basic colors
echo -e "${BLACK}BLACK${NC}, ${GRAY}GRAY${NC} or ${WHITE}WHITE${NC} color text"
echo -e "${RED}RED${NC} or ${BRIGHT_RED}BRIGHT_RED${NC} color text"
echo -e "${GREEN}GREEN${NC} or ${BRIGHT_GREEN}BRIGHT_GREEN${NC} color text"
echo -e "${BLUE}BLUE${NC} or ${BRIGHT_BLUE}BRIGHT_BLUE${NC} color text"
echo -e "${YELLOW}YELLOW${NC} or ${BRIGHT_YELLOW}BRIGHT_YELLOW${NC} color text"
echo -e "${MAGENTA}MAGENTA${NC} or ${BRIGHT_MAGENTA}BRIGHT_MAGENTA${NC} color text"
echo -e "${CYAN}CYAN${NC} or ${BRIGHT_CYAN}BRIGHT_CYAN${NC} color text"
echo -e "\n\n${GRAY}-----------------------------------------------------------------------------${NC}"
# with colors.sh sourced, you can use the constants # with colors.sh sourced, you can use the constants
echo -e "${RED}This is ${BOLD}bold red text${NC} and this is ${GREEN}green ${BLINK}blink${NC} text${NC}" echo -e "${RED}This is ${BOLD}bold red text${NC} and this is ${GREEN}green ${BLINK}blink${NC} text${NC}"
echo -e "this is ${MAGENTA}magenta ${BLINK}blink${NC} text${NC}" echo -e "this is ${MAGENTA}magenta ${BLINK}blink${NC} text${NC}"
@ -57,6 +47,6 @@ echo -e "${GRAY}----------------------------------------------------------------
{ {
echo "This is super text" echo "This is super text"
echo "Every line will be prefixed with hostname and script name" echo "Every line will be prefixed with hostname and script name"
printf "${GREEN}This is green text${NC}\n" printf "${GREEN}%s${NC}\n" "This is green text"
printf "${RED}This is red text${NC}\n" printf "${RED}%s${NC}\n" "This is red text"
} | awk '{printf "'${GRAY}[${HOSTNAME}'] ['$(basename "$0")']'${NC}' %s\n", $0; fflush(stdout)}' } | awk '{printf "'${GRAY}[${HOSTNAME}'] ['$(basename "$0")']'${NC}' %s\n", $0; fflush(stdout)}'