Update 3 files
- /home/dot_local/bin/executable_logg - /home/.chezmoitemplates/universal/logg-inline - /local/provision.sh
This commit is contained in:
parent
c0a3237bef
commit
1720e948f9
3 changed files with 14 additions and 11 deletions
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue