banner → bar
Some checks failed
/ arch (push) Successful in 2m56s
/ alpine (push) Successful in 2m7s
/ fedora (push) Successful in 14m54s
/ opensuse (push) Successful in 5m23s
/ alma (push) Successful in 13m3s
/ rocky (push) Successful in 23m26s
/ ubuntu (push) Successful in 7m15s
/ debian (push) Failing after 5m32s

This commit is contained in:
Marc Beninca 2024-09-10 12:38:10 +02:00
parent 03829cc4b4
commit d7142f2b1d
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -4,9 +4,9 @@
# │ __ = internal │
# ╰───────────────╯
# __SPCD_BANNER_TOP
# __SPCD_BANNER_MIDDLE
# __SPCD_BANNER_BOTTOM
# __SPCD_BAR_TOP
# __SPCD_BAR_MIDDLE
# __SPCD_BAR_BOTTOM
# __SPCD_STEP_LEVEL
# __SPCD_STEP_level_INDEX
@ -36,35 +36,35 @@ _spcd_fill() {
done
}
# ╭───┬────────
# │ _ │ banner │
# ╰───┴────────
# ╭───┬─────
# │ _ │ bar │
# ╰───┴─────
_SPCD_BANNER_BOTTOM_LEFT="${_SPCD_BOX_UP_AND_RIGHT}"
_SPCD_BANNER_BOTTOM_MIDDLE="${_SPCD_BOX_UP_AND_HORIZONTAL}"
_SPCD_BANNER_BOTTOM_RIGHT="${_SPCD_BOX_UP_AND_LEFT}"
_SPCD_BANNER_HORIZONTAL="${_SPCD_BOX_HORIZONTAL}"
_SPCD_BANNER_TOP_LEFT="${_SPCD_BOX_DOWN_AND_RIGHT}"
_SPCD_BANNER_TOP_MIDDLE="${_SPCD_BOX_DOWN_AND_HORIZONTAL}"
_SPCD_BANNER_TOP_RIGHT="${_SPCD_BOX_DOWN_AND_LEFT}"
_SPCD_BANNER_VERTICAL="${_SPCD_BOX_VERTICAL}"
_SPCD_BAR_BOTTOM_LEFT="${_SPCD_BOX_UP_AND_RIGHT}"
_SPCD_BAR_BOTTOM_MIDDLE="${_SPCD_BOX_UP_AND_HORIZONTAL}"
_SPCD_BAR_BOTTOM_RIGHT="${_SPCD_BOX_UP_AND_LEFT}"
_SPCD_BAR_HORIZONTAL="${_SPCD_BOX_HORIZONTAL}"
_SPCD_BAR_TOP_LEFT="${_SPCD_BOX_DOWN_AND_RIGHT}"
_SPCD_BAR_TOP_MIDDLE="${_SPCD_BOX_DOWN_AND_HORIZONTAL}"
_SPCD_BAR_TOP_RIGHT="${_SPCD_BOX_DOWN_AND_LEFT}"
_SPCD_BAR_VERTICAL="${_SPCD_BOX_VERTICAL}"
_spcd_banner_add() {
_spcd_bar_add() {
if [ -n "${1}" ]; then
local text length filler
text=" ${1} "
length=${#text}
filler="$(_spcd_fill "${length}" "${_SPCD_BANNER_HORIZONTAL}")"
if [ -n "${__SPCD_BANNER_MIDDLE}" ]; then
_spcd_banner_split
filler="$(_spcd_fill "${length}" "${_SPCD_BAR_HORIZONTAL}")"
if [ -n "${__SPCD_BAR_MIDDLE}" ]; then
_spcd_bar_split
else
_spcd_banner_open
_spcd_bar_open
fi
_spcd_banner_append "${filler}" "${text}" "${filler}"
_spcd_bar_append "${filler}" "${text}" "${filler}"
fi
}
_spcd_banner_add_index() {
_spcd_bar_add_index() {
local level value label
while true; do
level=$((level + 1))
@ -76,68 +76,68 @@ _spcd_banner_add_index() {
label="${value}"
fi
done
_spcd_banner_add "${label}"
_spcd_bar_add "${label}"
}
_spcd_banner_append() {
_spcd_bar_append() {
if [ -n "${3}" ]; then
__SPCD_BANNER_TOP="${__SPCD_BANNER_TOP}${1}"
__SPCD_BANNER_MIDDLE="${__SPCD_BANNER_MIDDLE}${2}"
__SPCD_BANNER_BOTTOM="${__SPCD_BANNER_BOTTOM}${3}"
__SPCD_BAR_TOP="${__SPCD_BAR_TOP}${1}"
__SPCD_BAR_MIDDLE="${__SPCD_BAR_MIDDLE}${2}"
__SPCD_BAR_BOTTOM="${__SPCD_BAR_BOTTOM}${3}"
fi
}
_spcd_banner_echo() {
_spcd_bar_echo() {
echo "\
${__SPCD_BANNER_TOP}
${__SPCD_BANNER_MIDDLE}
${__SPCD_BANNER_BOTTOM}"
${__SPCD_BAR_TOP}
${__SPCD_BAR_MIDDLE}
${__SPCD_BAR_BOTTOM}"
}
_spcd_banner_open() {
_spcd_banner_append \
"${_SPCD_BANNER_TOP_LEFT}" \
"${_SPCD_BANNER_VERTICAL}" \
"${_SPCD_BANNER_BOTTOM_LEFT}"
_spcd_bar_open() {
_spcd_bar_append \
"${_SPCD_BAR_TOP_LEFT}" \
"${_SPCD_BAR_VERTICAL}" \
"${_SPCD_BAR_BOTTOM_LEFT}"
}
_spcd_banner_render() {
_spcd_banner_wipe
_spcd_banner_add "S"
_spcd_banner_add_index
_spcd_bar_render() {
_spcd_bar_wipe
_spcd_bar_add "S"
_spcd_bar_add_index
#
local level value
while true; do
level=$((level + 1))
eval "value=\"\${__SPCD_STEP_${level}_LABEL}\""
[ -n "${value}" ] || break
_spcd_banner_add "${value}"
_spcd_bar_add "${value}"
done
#
_spcd_banner_shut
_spcd_banner_echo
_spcd_banner_wipe
_spcd_bar_shut
_spcd_bar_echo
_spcd_bar_wipe
}
_spcd_banner_shut() {
_spcd_banner_append \
"${_SPCD_BANNER_TOP_RIGHT}" \
"${_SPCD_BANNER_VERTICAL}" \
"${_SPCD_BANNER_BOTTOM_RIGHT}"
_spcd_bar_shut() {
_spcd_bar_append \
"${_SPCD_BAR_TOP_RIGHT}" \
"${_SPCD_BAR_VERTICAL}" \
"${_SPCD_BAR_BOTTOM_RIGHT}"
}
_spcd_banner_split() {
_spcd_banner_append \
"${_SPCD_BANNER_TOP_MIDDLE}" \
"${_SPCD_BANNER_VERTICAL}" \
"${_SPCD_BANNER_BOTTOM_MIDDLE}"
_spcd_bar_split() {
_spcd_bar_append \
"${_SPCD_BAR_TOP_MIDDLE}" \
"${_SPCD_BAR_VERTICAL}" \
"${_SPCD_BAR_BOTTOM_MIDDLE}"
}
_spcd_banner_wipe() {
_spcd_bar_wipe() {
unset \
__SPCD_BANNER_TOP \
__SPCD_BANNER_MIDDLE \
__SPCD_BANNER_BOTTOM
__SPCD_BAR_TOP \
__SPCD_BAR_MIDDLE \
__SPCD_BAR_BOTTOM
}
# ╭───┬───────╮
@ -320,7 +320,7 @@ spcd_step() {
local index="${prefix}_INDEX"
eval "${index}=\$((${index} + 1))"
eval "${prefix}_LABEL=\"${1}\""
_spcd_banner_render
_spcd_bar_render
fi
}