From b2e3a5db4cfd96117c0c093e7b86839010a167d5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 24 Aug 2024 13:00:25 +0200 Subject: [PATCH] mv --- spcd/main.sh | 121 ++++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 59 deletions(-) diff --git a/spcd/main.sh b/spcd/main.sh index 81f5556..f0571a9 100644 --- a/spcd/main.sh +++ b/spcd/main.sh @@ -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