Compare commits
21 commits
a1ef8cab40
...
2ac2c86d2c
Author | SHA1 | Date | |
---|---|---|---|
2ac2c86d2c | |||
a6bbad3f86 | |||
30e4f3c75d | |||
eb843769dd | |||
b4a2a647cd | |||
619b374337 | |||
2500654681 | |||
76937bc1bf | |||
8875d08a2e | |||
195130b14e | |||
c39a9ba887 | |||
1a41e044e6 | |||
8e3d1e493a | |||
e74984a6cb | |||
54e396368f | |||
cb18544542 | |||
bc70510bfc | |||
00daad9731 | |||
c998143933 | |||
63ab82e03e | |||
c6c855bdac |
2 changed files with 117 additions and 54 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
162
spcd/main.sh
162
spcd/main.sh
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue