Skip to content

Commit

Permalink
Fix to unify ASCII and UTF-8 spinners
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Dec 18, 2022
1 parent a24a2df commit d249d01
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions slib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,12 @@ log_debug() { log "$1" "DEBUG" "${LOG_DEBUG_COLOR}"; }
SPINNER_COLORNUM=2 # What color? Irrelevent if COLORCYCLE=1.
SPINNER_COLORCYCLE=1 # Does the color cycle?
SPINNER_DONEFILE="stopspinning" # Path/name of file to exit on.
SPINNER_SYMBOLS="ASCII_PROPELLER" # Name of the variable containing the symbols.
SPINNER_SYMBOLS="WIDE_ASCII_PROG" # Name of the variable containing the symbols.
SPINNER_CLEAR=1 # Blank the line when done.

spinner () {
# Safest option are one of these. Doesn't need Unicode, at all.
local ASCII_PROPELLER="/ - \\ |"

# Bigger spinners and progress type bars; takes more space.
local WIDE_ASCII_PROG="[>---] [=>--] [==>-] [===>] [---<] [--<=] [-<==] [<===]"
local WIDE_ASCII_PROG="[>-] [->] [--] [--]"
local WIDE_UNI_GREYSCALE2="▒▒▒ █▒▒ ██▒ ███ ▒██ ▒▒█ ▒▒▒"

local SPINNER_NORMAL
Expand Down Expand Up @@ -368,11 +365,11 @@ run_ok () {
else
if [ $res -eq 0 ]; then
printf "Success.\\n" >> ${RUN_LOG}
env printf "${GREENBG}[ OK ]${NORMAL}\\n"
env printf "${GREENBG} OK ${NORMAL}\\n"
return 0
else
printf "Failed with error: ${res}\\n" >> ${RUN_LOG}
env printf "${REDBG}[ ER ]${NORMAL}\\n"
env printf "${REDBG} ER ${NORMAL}\\n"
if [ "$RUN_ERRORS_FATAL" ]; then
log_fatal "Something went wrong with the previous command. Exiting."
exit 1
Expand Down

0 comments on commit d249d01

Please sign in to comment.