Compare commits

..

21 commits

Author SHA1 Message Date
2ac2c86d2c
spcd_banner_render/loop
Some checks failed
/ job (push) Failing after 2m55s
2024-08-25 17:19:31 +02:00
a6bbad3f86
spcd_banner_render 2024-08-25 17:14:42 +02:00
30e4f3c75d
spcd_banner_add_index 2024-08-25 17:10:26 +02:00
eb843769dd
banner/index 2024-08-25 17:06:30 +02:00
b4a2a647cd
spcd_banner_index 2024-08-25 17:04:34 +02:00
619b374337
spcd_banner_add/open,split 2024-08-25 16:08:12 +02:00
2500654681
step/escape 2024-08-25 15:56:33 +02:00
76937bc1bf
step/level,index,label 2024-08-25 15:48:00 +02:00
8875d08a2e
banner/unset 2024-08-25 15:17:25 +02:00
195130b14e
step/in,out,wipe 2024-08-25 15:15:21 +02:00
c39a9ba887
spcd_substep 2024-08-25 15:04:41 +02:00
1a41e044e6
spcd_step_out 2024-08-25 15:03:28 +02:00
8e3d1e493a
spcd_step_in 2024-08-25 15:03:08 +02:00
e74984a6cb
functions/step 2024-08-25 14:59:50 +02:00
54e396368f
banner/order 2024-08-25 14:36:41 +02:00
cb18544542
banner/chars 2024-08-25 14:25:37 +02:00
bc70510bfc
banner/chars 2024-08-25 12:16:26 +02:00
00daad9731
banner/vertical 2024-08-25 12:09:49 +02:00
c998143933
banner/chars 2024-08-25 12:03:48 +02:00
63ab82e03e
banner/top,middle,bottom 2024-08-25 07:06:10 +02:00
c6c855bdac
readme/tasks 2024-08-25 06:58:12 +02:00
2 changed files with 117 additions and 54 deletions

View file

@ -213,13 +213,15 @@ Handle project workflows in a unified way:
### Shell ### Shell
* banner with constants for characters * banner
* constants for characters
* dynamic substeps
* comment * comment
* review repositories handling for systems * review repositories handling for systems
* opensuse * opensuse
* codecs repository * codecs repository
* disable & enable https * disable & enable https
* write unit tests * test
### Shell → Python ### Shell → Python
@ -247,6 +249,7 @@ Handle project workflows in a unified way:
* .py * .py
* .sh * .sh
* maximum line length * maximum line length
* comment
* detect ssh private key type * detect ssh private key type
* fit banner to text * fit banner to text
* implement substeps * implement substeps
@ -255,7 +258,7 @@ Handle project workflows in a unified way:
* actions * actions
* includes * includes
* try git repo url variable first for shunit * try git repo url variable first for shunit
* write unit tests * test
### Later ### Later

View file

@ -866,6 +866,30 @@ ${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}"
"${SPCD_PYTHON_ALIAS}" -m "${spcd_stp__name}" "${SPCD_PYTHON_ALIAS}" -m "${spcd_stp__name}"
} }
# ╭───────────┬──────╮
# │ functions │ step │
# ╰───────────┴──────╯
spcd_step() {
if [ -n "${1}" ]; then
spcd_step__prefix="SPCD_STEP_${SPCD_STEP_LEVEL}"
spcd_step__index="${spcd_step__prefix}_INDEX"
eval "${spcd_step__index}=\$((${spcd_step__index} + 1))"
eval "${spcd_step__prefix}_LABEL=\"${1}\""
spcd_banner_render
fi
}
spcd_step_in() {
SPCD_STEP_LEVEL=$((SPCD_STEP_LEVEL + 1))
spcd_step_wipe
}
spcd_step_out() {
spcd_step_wipe
SPCD_STEP_LEVEL=$((SPCD_STEP_LEVEL - 1))
}
# ╭───────────╮ # ╭───────────╮
# │ functions │ # │ functions │
# ╰───────────╯ # ╰───────────╯
@ -1016,19 +1040,6 @@ spcd_split() {
echo "${SPCD_SPLT}" echo "${SPCD_SPLT}"
} }
spcd_step() {
SPCD_STEP=$((SPCD_STEP + 1))
SPCD_STEP_TEXT="${*}"
unset SPCD_SUBSTEP SPCD_SUBSTEP_TEXT
spcd_banner
}
spcd_substep() {
SPCD_SUBSTEP=$((SPCD_SUBSTEP + 1))
SPCD_SUBSTEP_TEXT="${*}"
spcd_banner
}
spcd_write() { spcd_write() {
spcd_write__file="${1}" spcd_write__file="${1}"
spcd_write__text="${2}" spcd_write__text="${2}"
@ -1097,74 +1108,123 @@ spcd_fill() {
# │ internal │ banner │ # │ internal │ banner │
# ╰──────────┴────────╯ # ╰──────────┴────────╯
spcd_banner() { SPCD_BANNER_DOWN_AND_HORIZONTAL="┬"
spcd_banner_unset SPCD_BANNER_DOWN_AND_LEFT="╮"
spcd_banner_open SPCD_BANNER_DOWN_AND_RIGHT="╭"
# SPCD_BANNER_HORIZONTAL="─"
spcd_banner__index="${SPCD_STEP}" SPCD_BANNER_UP_AND_HORIZONTAL="┴"
[ -n "${SPCD_SUBSTEP}" ] && SPCD_BANNER_UP_AND_LEFT="╯"
spcd_banner__index="${spcd_banner__index}.${SPCD_SUBSTEP}" SPCD_BANNER_UP_AND_RIGHT="╰"
spcd_banner_add "${spcd_banner__index}" SPCD_BANNER_VERTICAL="│"
#
spcd_banner_split
spcd_banner_add "S"
#
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
#
spcd_banner_echo
spcd_banner_unset
}
spcd_banner_add() { spcd_banner_add() {
if [ -n "${1}" ]; then if [ -n "${1}" ]; then
spcd_ba__text=" ${1} " spcd_ba__text=" ${1} "
spcd_ba__length=${#spcd_ba__text} spcd_ba__length=${#spcd_ba__text}
spcd_ba__filler="$(spcd_fill "${spcd_ba__length}")" spcd_ba__filler="$(
spcd_fill "${spcd_ba__length}" "${SPCD_BANNER_HORIZONTAL}"
)"
if [ -n "${SPCD_BANNER_MIDDLE}" ]; then
spcd_banner_split
else
spcd_banner_open
fi
spcd_banner_append \ spcd_banner_append \
"${spcd_ba__filler}" "${spcd_ba__text}" "${spcd_ba__filler}" "${spcd_ba__filler}" "${spcd_ba__text}" "${spcd_ba__filler}"
fi fi
} }
spcd_banner_add_index() {
unset spcd_bi__label
unset spcd_bi__level
while true; do
spcd_bi__level=$((spcd_bi__level + 1))
eval "spcd_bi__value=\"\${SPCD_BANNER_${spcd_bi__level}_INDEX}\""
[ -n "${spcd_bi__value}" ] || break
if [ -n "${spcd_bi__label}" ]; then
spcd_bi__label="${spcd_bi__label}.${spcd_bi__value}"
else
spcd_bi__label="${spcd_bi__value}"
fi
done
spcd_banner_add "${spcd_bi__label}"
}
spcd_banner_append() { spcd_banner_append() {
if [ -n "${3}" ]; then if [ -n "${3}" ]; then
SPCD_BANNER_1="${SPCD_BANNER_1}${1}" SPCD_BANNER_TOP="${SPCD_BANNER_TOP}${1}"
SPCD_BANNER_2="${SPCD_BANNER_2}${2}" SPCD_BANNER_MIDDLE="${SPCD_BANNER_MIDDLE}${2}"
SPCD_BANNER_3="${SPCD_BANNER_3}${3}" SPCD_BANNER_BOTTOM="${SPCD_BANNER_BOTTOM}${3}"
fi fi
} }
spcd_banner_close() { spcd_banner_close() {
spcd_banner_append "╮" "${SPCD_VERT}" "╯" spcd_banner_append \
"${SPCD_BANNER_DOWN_AND_LEFT}" \
"${SPCD_BANNER_VERTICAL}" \
"${SPCD_BANNER_UP_AND_LEFT}"
} }
spcd_banner_echo() { spcd_banner_echo() {
echo "\ echo "\
${SPCD_BANNER_1} ${SPCD_BANNER_TOP}
${SPCD_BANNER_2} ${SPCD_BANNER_MIDDLE}
${SPCD_BANNER_3}" ${SPCD_BANNER_BOTTOM}"
} }
spcd_banner_open() { spcd_banner_open() {
spcd_banner_append "${SPCD_BOX_DOWN}" "${SPCD_VERT}" "${SPCD_BOX_UP}" spcd_banner_append \
"${SPCD_BANNER_DOWN_AND_RIGHT}" \
"${SPCD_BANNER_VERTICAL}" \
"${SPCD_BANNER_UP_AND_RIGHT}"
}
spcd_banner_render() {
spcd_banner_unset
spcd_banner_add_index
spcd_banner_add "S"
#
unset spcd_br__level
while true; do
spcd_br__level=$((spcd_br__level + 1))
eval "spcd_br__value=\"\${SPCD_BANNER_${spcd_br__level}_LABEL}\""
[ -n "${spcd_br__value}" ] || break
spcd_banner_add "${spcd_br__value}"
done
#
spcd_banner_close
spcd_banner_echo
spcd_banner_unset
} }
spcd_banner_split() { spcd_banner_split() {
spcd_banner_append "┬" "${SPCD_VERT}" "┴" spcd_banner_append \
"${SPCD_BANNER_DOWN_AND_HORIZONTAL}" \
"${SPCD_BANNER_VERTICAL}" \
"${SPCD_BANNER_UP_AND_HORIZONTAL}"
} }
spcd_banner_unset() { spcd_banner_unset() {
unset SPCD_BANNER_1 SPCD_BANNER_2 SPCD_BANNER_3 unset \
SPCD_BANNER_TOP \
SPCD_BANNER_MIDDLE \
SPCD_BANNER_BOTTOM
} }
# ╭──────────┬─────╮ # ╭──────────┬──────╮
# │ internal │ run │ # │ internal │ step │
# ╰──────────┴─────╯ # ╰──────────┴──────╯
SPCD_STEP=1
spcd_step_wipe() {
unset \
"SPCD_STEP_${SPCD_STEP_LEVEL}_INDEX" \
"SPCD_STEP_${SPCD_STEP_LEVEL}_LABEL"
}
# ╭──────────╮
# │ internal │
# ╰──────────╯
spcd_main spcd_main