This commit is contained in:
Marc Beninca 2024-08-24 13:00:25 +02:00
parent 3784d4d6a6
commit b2e3a5db4c
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -827,65 +827,6 @@ ${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}"
# functions
spcd_banner() {
spcd_banner_wipe
spcd_banner_open
#
spcd_banner__index="${SPCD_STEP}"
[ -n "${SPCD_SUBSTEP}" ] &&
spcd_banner__index="${spcd_banner__index}.${SPCD_SUBSTEP}"
spcd_banner_add "${spcd_banner__index}"
#
for spcd_banner__item in "${SPCD_STEP_TEXT}" "${SPCD_SUBSTEP_TEXT}"; do
if [ -n "${spcd_banner__item}" ]; then
spcd_banner_split
spcd_banner_add "${spcd_banner__item}"
fi
done
#
spcd_banner_close
#
echo "\
${SPCD_BANNER_1}
${SPCD_BANNER_2}
${SPCD_BANNER_3}"
spcd_banner_wipe
}
spcd_banner_add() {
if [ -n "${1}" ]; then
spcd_ba__text=" ${1} "
spcd_ba__length=${#spcd_ba__text}
spcd_ba__filler="$(spcd_fill "${spcd_ba__length}")"
spcd_banner_add_123 \
"${spcd_ba__filler}" "${spcd_ba__text}" "${spcd_ba__filler}"
fi
}
spcd_banner_add_123() {
if [ -n "${3}" ]; then
SPCD_BANNER_1="${SPCD_BANNER_1}${1}"
SPCD_BANNER_2="${SPCD_BANNER_2}${2}"
SPCD_BANNER_3="${SPCD_BANNER_3}${3}"
fi
}
spcd_banner_close() {
spcd_banner_add_123 "╮" "${SPCD_VERT}" "╯"
}
spcd_banner_open() {
spcd_banner_add_123 "${SPCD_BOX_DOWN}" "${SPCD_VERT}" "${SPCD_BOX_UP}"
}
spcd_banner_split() {
spcd_banner_add_123 "┬" "${SPCD_VERT}" "┴"
}
spcd_banner_wipe() {
unset SPCD_BANNER_1 SPCD_BANNER_2 SPCD_BANNER_3
}
spcd_cat() {
spcd_cat__file="${1}"
if [ -n "${spcd_cat__file}" ]; then
@ -1105,5 +1046,67 @@ SPCD_VERT="${SPCD_BOX_VERTICAL}"
SPCD_SPLT="${SPCD_BOX_RIGHT}${SPCD_HORIZONTAL}"
SPCD_SHUT="${SPCD_BOX_UP}${SPCD_BOX_LEFT}"
# log
spcd_banner() {
spcd_banner_wipe
spcd_banner_open
#
spcd_banner__index="${SPCD_STEP}"
[ -n "${SPCD_SUBSTEP}" ] &&
spcd_banner__index="${spcd_banner__index}.${SPCD_SUBSTEP}"
spcd_banner_add "${spcd_banner__index}"
#
for spcd_banner__item in "${SPCD_STEP_TEXT}" "${SPCD_SUBSTEP_TEXT}"; do
if [ -n "${spcd_banner__item}" ]; then
spcd_banner_split
spcd_banner_add "${spcd_banner__item}"
fi
done
#
spcd_banner_close
#
echo "\
${SPCD_BANNER_1}
${SPCD_BANNER_2}
${SPCD_BANNER_3}"
spcd_banner_wipe
}
spcd_banner_add() {
if [ -n "${1}" ]; then
spcd_ba__text=" ${1} "
spcd_ba__length=${#spcd_ba__text}
spcd_ba__filler="$(spcd_fill "${spcd_ba__length}")"
spcd_banner_add_123 \
"${spcd_ba__filler}" "${spcd_ba__text}" "${spcd_ba__filler}"
fi
}
spcd_banner_add_123() {
if [ -n "${3}" ]; then
SPCD_BANNER_1="${SPCD_BANNER_1}${1}"
SPCD_BANNER_2="${SPCD_BANNER_2}${2}"
SPCD_BANNER_3="${SPCD_BANNER_3}${3}"
fi
}
spcd_banner_close() {
spcd_banner_add_123 "╮" "${SPCD_VERT}" "╯"
}
spcd_banner_open() {
spcd_banner_add_123 "${SPCD_BOX_DOWN}" "${SPCD_VERT}" "${SPCD_BOX_UP}"
}
spcd_banner_split() {
spcd_banner_add_123 "┬" "${SPCD_VERT}" "┴"
}
spcd_banner_wipe() {
unset SPCD_BANNER_1 SPCD_BANNER_2 SPCD_BANNER_3
}
# run
spcd_main