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