diff --git a/home/.chezmoitemplates/universal/logg-inline b/home/.chezmoitemplates/universal/logg-inline index ee7e518e..a16d2e30 100644 --- a/home/.chezmoitemplates/universal/logg-inline +++ b/home/.chezmoitemplates/universal/logg-inline @@ -119,7 +119,7 @@ formatFaint() { echo -e "$ANSI_STR_FORMATTED" } -# @description Logs using Node.js +# @description Logs using Gum # @example logger info "An informative log" logg() { TYPE="$1" diff --git a/home/dot_local/bin/executable_logg b/home/dot_local/bin/executable_logg index f4ca70d4..9b151b16 100644 --- a/home/dot_local/bin/executable_logg +++ b/home/dot_local/bin/executable_logg @@ -119,14 +119,16 @@ if [ -n "$SEMANTIC_RELEASE" ]; then NO_LOGGING=true fi -# @description Logs using Node.js +# @description Logs using Gum # @example logger info "An informative log" -logger() { - if [ "$1" == 'error' ]; then - "$GUM_PATH" style --border="thick" "$("$GUM_PATH" style --foreground="#ff0000" "✖") $("$GUM_PATH" style --bold --background="#ff0000" --foreground="#ffffff" " ERROR ") $("$GUM_PATH" style --bold "$(format "$2")")" - elif [ "$1" == 'info' ]; then - "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ffff" "○") $("$GUM_PATH" style --faint "$(formatFaint "$2")")" - elif [ "$1" == 'md' ]; then +logg() { + TYPE="$1" + MSG="$2" + if [ "$TYPE" == 'error' ]; then + "$GUM_PATH" style --border="thick" "$("$GUM_PATH" style --foreground="#ff0000" "✖") $("$GUM_PATH" style --bold --background="#ff0000" --foreground="#ffffff" " ERROR ") $("$GUM_PATH" style --bold "$(format "$MSG")")" + elif [ "$TYPE" == 'info' ]; then + "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ffff" "○") $("$GUM_PATH" style --faint --foreground="#ffffff" "$(formatFaint "$MSG")")" + elif [ "$TYPE" == 'md' ]; then # @description Ensure glow is installed if [ "${container:=}" != 'docker' ]; then if type glow &> /dev/null; then @@ -183,12 +185,13 @@ format() { formatFaint() { # shellcheck disable=SC2001,SC2016 ANSI_STR_FORMATTED="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`.*/\1\\u001b[47;30m \2 \\e[49;m/')" + # shellcheck disable=SC2001,SC2016 ANSI_STR="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`\(.*\)$/\3/')" if [ "$ANSI_STR_FORMATTED" != "$ANSI_STR" ]; then if [[ $ANSI_STR == *'`'*'`'* ]]; then - ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$(formatFaint "$("$GUM_PATH" style --faint "$ANSI_STR")")" + ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$(formatFaint "$("$GUM_PATH" style --faint --foreground="#ffffff" "$ANSI_STR")")" else - ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$("$GUM_PATH" style --faint "$ANSI_STR")" + ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$("$GUM_PATH" style --faint --foreground="#ffffff" "$ANSI_STR")" fi fi echo -e "$ANSI_STR_FORMATTED" diff --git a/local/provision.sh b/local/provision.sh index f4504876..4eef925c 100644 --- a/local/provision.sh +++ b/local/provision.sh @@ -132,7 +132,7 @@ formatFaint() { echo -e "$ANSI_STR_FORMATTED" } -# @description Logs using Node.js +# @description Logs using Gum # @example logger info "An informative log" logg() { TYPE="$1"