From b98079b90587a41d365142f13396c0d1612c0356 Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Wed, 15 Sep 2021 17:54:22 -0600 Subject: [PATCH] moving color utils to submodule --- zsh/utils/color.zsh | 21 ------------------- zsh/utils/color/check.zsh | 26 ------------------------ zsh/utils/color/console-color-out.zsh | 19 ------------------ zsh/utils/color/messages.zsh | 29 --------------------------- zsh/utils/color/names.zsh | 23 --------------------- zsh/utils/color/prefix.zsh | 0 6 files changed, 118 deletions(-) delete mode 100644 zsh/utils/color.zsh delete mode 100644 zsh/utils/color/check.zsh delete mode 100644 zsh/utils/color/console-color-out.zsh delete mode 100644 zsh/utils/color/messages.zsh delete mode 100644 zsh/utils/color/names.zsh delete mode 100644 zsh/utils/color/prefix.zsh diff --git a/zsh/utils/color.zsh b/zsh/utils/color.zsh deleted file mode 100644 index e129033..0000000 --- a/zsh/utils/color.zsh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/zsh -[ ! $COLOR_PATH ] && COLOR_PATH="${0:a:h}/color" - -# use colors by name -source "$COLOR_PATH/names.zsh" - - -# console message helper function -source "$COLOR_PATH/console-color-out.zsh" - - -# write full line messages with semantic name -# e.g. 'ERROR : something bad happened' (in red) -source "$COLOR_PATH/messages.zsh" - - -# two-piece message, check message >> run some stuff >> status -# the status appears on the same line as the check -# -# e.g. 'CHECK : installing something... ✔ OK' -source "$COLOR_PATH/check.zsh" diff --git a/zsh/utils/color/check.zsh b/zsh/utils/color/check.zsh deleted file mode 100644 index 581e6cb..0000000 --- a/zsh/utils/color/check.zsh +++ /dev/null @@ -1,26 +0,0 @@ -function CHECK() { - SINGLE_LINE=1 CONSOLE_COLOR_OUT $WHITE $PREFIX_CHK $@'... ' -} - -function CHECK_RESULT() { - local color="$1" - local output="$2" - printf "\\033[$color""m$output\\033[0m\n" -} - -function OK() { - CHECK_RESULT $LIGHT_GREEN '✔ OK' - [ $1 ] && SUCCESS $@ - return 0 -} - -function WARN() { - CHECK_RESULT $YELLOW '⚠ WARN' - [ $1 ] && WARNING $@ - return 0 -} - -function FAIL() { - CHECK_RESULT $LIGHT_RED '✖ FAIL' - FATAL $@ -} diff --git a/zsh/utils/color/console-color-out.zsh b/zsh/utils/color/console-color-out.zsh deleted file mode 100644 index fdd4293..0000000 --- a/zsh/utils/color/console-color-out.zsh +++ /dev/null @@ -1,19 +0,0 @@ -[ ! $PREFIX_ERR ] && PREFIX_ERR='ERROR ' -[ ! $PREFIX_FAT ] && PREFIX_FAT='FATAL ' -[ ! $PREFIX_WRN ] && PREFIX_WRN='WARNING' -[ ! $PREFIX_SCS ] && PREFIX_SCS='SUCCESS' -[ ! $PREFIX_STS ] && PREFIX_STS='STATUS ' -[ ! $PREFIX_USR ] && PREFIX_USR='USER ' -[ ! $PREFIX_BLK ] && PREFIX_BLK=' ' -[ ! $PREFIX_CHK ] && PREFIX_CHK='CHECK ' - -function CONSOLE_COLOR_OUT() { - local color="$1" - local prefix="$2" - - local message="\\033[$color""m$prefix :: ${@:3}\\033[0m" - - [ ! $SINGLE_LINE ] && message="$message\n" - - printf $message -} diff --git a/zsh/utils/color/messages.zsh b/zsh/utils/color/messages.zsh deleted file mode 100644 index a9c73cd..0000000 --- a/zsh/utils/color/messages.zsh +++ /dev/null @@ -1,29 +0,0 @@ -function ERROR() { - CONSOLE_COLOR_OUT $RED $PREFIX_ERR $@ -} - -function FATAL() { - ERROR $@ - CONSOLE_COLOR_OUT $RED $PREFIX_FAT 'exiting' - exit 1 -} - -function WARNING() { - CONSOLE_COLOR_OUT $ORANGE $PREFIX_WRN $@ -} - -function STATUS() { - CONSOLE_COLOR_OUT $PURPLE $PREFIX_STS $@ -} - -function SUCCESS() { - CONSOLE_COLOR_OUT $GREEN $PREFIX_SCS $@ -} - -function USER_PROMPT() { - SINGLE_LINE=1 CONSOLE_COLOR_OUT $CYAN $PREFIX_USR $@ -} - -function MENU() { - CONSOLE_COLOR_OUT $YELLOW $PREFIX_BLK $@ -} diff --git a/zsh/utils/color/names.zsh b/zsh/utils/color/names.zsh deleted file mode 100644 index f942b83..0000000 --- a/zsh/utils/color/names.zsh +++ /dev/null @@ -1,23 +0,0 @@ -BLACK='0;30' -DARK_GRAY='1;30' - -RED='0;31' -LIGHT_RED='1;31' - -GREEN='0;32' -LIGHT_GREEN='1;32' - -ORANGE='0;33' -YELLOW='1;33' - -BLUE='0;34' -LIGHT_BLUE='1;34' - -PURPLE='0;35' -LIGHT_PURPLE='1;35' - -CYAN='0;36' -LIGHT_CYAN='1;36' - -LIGHT_GRAY='0;37' -WHITE='1;37' diff --git a/zsh/utils/color/prefix.zsh b/zsh/utils/color/prefix.zsh deleted file mode 100644 index e69de29..0000000