Compare commits
11 commits
dfa9fc1a7a
...
31ca2c6117
Author | SHA1 | Date | |
---|---|---|---|
31ca2c6117 | |||
6f3c5a8143 | |||
e0552167bf | |||
2b37cc9479 | |||
855ac59ed3 | |||
cd2f40f398 | |||
f257864aba | |||
835ad7279c | |||
3634ea4a77 | |||
6c1dd6fa84 | |||
6b8a1e46b9 |
3 changed files with 49 additions and 51 deletions
|
@ -1,3 +1,3 @@
|
||||||
disable=2312
|
disable=2312,3043
|
||||||
enable=all
|
enable=all
|
||||||
shell=sh
|
shell=sh
|
||||||
|
|
|
@ -225,9 +225,7 @@ Handle project workflows in a unified way:
|
||||||
* comment
|
* comment
|
||||||
* drawing characters constants
|
* drawing characters constants
|
||||||
* handle errors
|
* handle errors
|
||||||
* locales
|
* local variables
|
||||||
* set unicode C
|
|
||||||
* set unicode language
|
|
||||||
* packages
|
* packages
|
||||||
* configure
|
* configure
|
||||||
* apk
|
* apk
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
# ╰───╯
|
# ╰───╯
|
||||||
|
|
||||||
_spcd_fill() {
|
_spcd_fill() {
|
||||||
_spcd_fill__index=${1}
|
local index="${1}"
|
||||||
while [ "${_spcd_fill__index}" -gt 0 ]; do
|
while [ "${index}" -gt 0 ]; do
|
||||||
printf "%s" "${2}"
|
printf "%s" "${2}"
|
||||||
_spcd_fill__index=$((_spcd_fill__index - 1))
|
index=$((index - 1))
|
||||||
done
|
done
|
||||||
unset _spcd_fill__index
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭───┬────────╮
|
# ╭───┬────────╮
|
||||||
|
@ -28,35 +27,33 @@ _SPCD_BANNER_VERTICAL="│"
|
||||||
|
|
||||||
_spcd_banner_add() {
|
_spcd_banner_add() {
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
spcd_ba__text=" ${1} "
|
local text=" ${1} "
|
||||||
spcd_ba__length=${#spcd_ba__text}
|
local length=${#text}
|
||||||
spcd_ba__filler="$(
|
local filler="$(_spcd_fill "${length}" "${_SPCD_BANNER_HORIZONTAL}")"
|
||||||
_spcd_fill "${spcd_ba__length}" "${_SPCD_BANNER_HORIZONTAL}"
|
|
||||||
)"
|
|
||||||
if [ -n "${__SPCD_BANNER_MIDDLE}" ]; then
|
if [ -n "${__SPCD_BANNER_MIDDLE}" ]; then
|
||||||
_spcd_banner_split
|
_spcd_banner_split
|
||||||
else
|
else
|
||||||
_spcd_banner_open
|
_spcd_banner_open
|
||||||
fi
|
fi
|
||||||
_spcd_banner_append \
|
_spcd_banner_append "${filler}" "${text}" "${filler}"
|
||||||
"${spcd_ba__filler}" "${spcd_ba__text}" "${spcd_ba__filler}"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_spcd_banner_add_index() {
|
_spcd_banner_add_index() {
|
||||||
unset spcd_bai__label
|
local label
|
||||||
unset spcd_bai__level
|
local level
|
||||||
|
local value
|
||||||
while true; do
|
while true; do
|
||||||
spcd_bai__level=$((spcd_bai__level + 1))
|
level=$((level + 1))
|
||||||
eval "spcd_bai__value=\"\${__SPCD_STEP_${spcd_bai__level}_INDEX}\""
|
eval "value=\"\${__SPCD_STEP_${level}_INDEX}\""
|
||||||
[ -n "${spcd_bai__value}" ] || break
|
[ -n "${value}" ] || break
|
||||||
if [ -n "${spcd_bai__label}" ]; then
|
if [ -n "${label}" ]; then
|
||||||
spcd_bai__label="${spcd_bai__label}.${spcd_bai__value}"
|
label="${label}.${value}"
|
||||||
else
|
else
|
||||||
spcd_bai__label="${spcd_bai__value}"
|
label="${value}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
_spcd_banner_add "${spcd_bai__label}"
|
_spcd_banner_add "${label}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_spcd_banner_append() {
|
_spcd_banner_append() {
|
||||||
|
@ -86,12 +83,13 @@ _spcd_banner_render() {
|
||||||
_spcd_banner_add "S"
|
_spcd_banner_add "S"
|
||||||
_spcd_banner_add_index
|
_spcd_banner_add_index
|
||||||
#
|
#
|
||||||
unset spcd_br__level
|
local level
|
||||||
|
local value
|
||||||
while true; do
|
while true; do
|
||||||
spcd_br__level=$((spcd_br__level + 1))
|
level=$((level + 1))
|
||||||
eval "spcd_br__value=\"\${__SPCD_STEP_${spcd_br__level}_LABEL}\""
|
eval "value=\"\${__SPCD_STEP_${level}_LABEL}\""
|
||||||
[ -n "${spcd_br__value}" ] || break
|
[ -n "${value}" ] || break
|
||||||
_spcd_banner_add "${spcd_br__value}"
|
_spcd_banner_add "${value}"
|
||||||
done
|
done
|
||||||
#
|
#
|
||||||
_spcd_banner_shut
|
_spcd_banner_shut
|
||||||
|
@ -223,10 +221,10 @@ spcd_openssl_x509() {
|
||||||
# ╰───────────┴────╯
|
# ╰───────────┴────╯
|
||||||
|
|
||||||
spcd_os_grep() {
|
spcd_os_grep() {
|
||||||
spcd_os_grep__variable="${1}"
|
local variable="${1}"
|
||||||
[ -n "${spcd_os_grep__variable}" ] &&
|
[ -n "${variable}" ] &&
|
||||||
grep "^${spcd_os_grep__variable}=" "/etc/os-release" |
|
grep "^${variable}=" "/etc/os-release" |
|
||||||
sed "s|^${spcd_os_grep__variable}=||" |
|
sed "s|^${variable}=||" |
|
||||||
sed "s|^\"\(.*\)\"$|\1|"
|
sed "s|^\"\(.*\)\"$|\1|"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,10 +243,11 @@ spcd_os_mkdir() {
|
||||||
|
|
||||||
spcd_os_printenv() {
|
spcd_os_printenv() {
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
for spcd_os_printenv__name in "${@}"; do
|
local name
|
||||||
spcd_os_printenv__text=""
|
local text
|
||||||
eval "spcd_os_printenv__text=\"\${${spcd_os_printenv__name}}\""
|
for name in "${@}"; do
|
||||||
echo "${spcd_os_printenv__name} = \"${spcd_os_printenv__text}\""
|
eval "text=\"\${${name}}\""
|
||||||
|
echo "${name} = \"${text}\""
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -261,26 +260,27 @@ spcd_os_rm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_sed() {
|
spcd_os_sed() {
|
||||||
spcd_os_sed__file="${1}"
|
local file="${1}"
|
||||||
shift
|
shift
|
||||||
if [ -f "${spcd_os_sed__file}" ]; then
|
if [ -f "${file}" ]; then
|
||||||
_spcd_os_cat "${spcd_os_sed__file}"
|
local regex
|
||||||
for spcd_os_sed__regex in "${@}"; do
|
_spcd_os_cat "${file}"
|
||||||
sed --in-place "s${spcd_os_sed__regex}g" "${spcd_os_sed__file}" &&
|
for regex in "${@}"; do
|
||||||
_spcd_os_cat "${spcd_os_sed__file}"
|
sed --in-place "s${regex}g" "${file}" &&
|
||||||
|
_spcd_os_cat "${file}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_write() {
|
spcd_os_write() {
|
||||||
spcd_os_write__file="${1}"
|
local file="${1}"
|
||||||
spcd_os_write__text="${2}"
|
local text="${2}"
|
||||||
if [ -n "${spcd_os_write__file}" ]; then
|
if [ -n "${file}" ]; then
|
||||||
[ -f "${spcd_os_write__file}" ] &&
|
[ -f "${file}" ] &&
|
||||||
_spcd_os_cat "${spcd_os_write__file}"
|
_spcd_os_cat "${file}"
|
||||||
echo "→ ${spcd_os_write__file}"
|
echo "→ ${file}"
|
||||||
printf "%s" "${spcd_os_write__text}" >"${spcd_os_write__file}"
|
printf "%s" "${text}" >"${file}"
|
||||||
_spcd_os_cat "${spcd_os_write__file}"
|
_spcd_os_cat "${file}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue