style(cli): box section headers and the logo in double-line borders

Swap the ### hash headers (isHeader) for a ╔═╗ ║ ╚═╝ double-line box and
wrap the LibrePortal logo in a matching 52-wide box. Build the rule with
printf-repeat and fixed pad widths instead of tr/${#} so multibyte box
chars stay aligned regardless of locale. Mirrors the credentials panel.

Applied to all three copies (markers.sh, init.sh, generate_arrays.sh).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-22 11:50:45 +01:00
parent afaa43de36
commit f7240cd096
4 changed files with 38 additions and 39 deletions

25
init.sh
View File

@ -30,11 +30,12 @@ isNotice() { echo -e "${YELLOW}NOTICE:${NC} $1"; }
isQuestion() { echo -e -n "${BLUE}QUESTION:${NC} $1 "; } isQuestion() { echo -e -n "${BLUE}QUESTION:${NC} $1 "; }
displayLibrePortalLogo() { displayLibrePortalLogo() {
echo " local hbar; hbar=$(printf '═%.0s' $(seq 1 50))
╦ ┬┌┐ ┬─┐┌─┐ ╭─╮ ╔═╗┌─┐┬─┐┌┬┐┌─┐┬ printf '\n╔%s╗\n' "$hbar"
║ │├┴┐├┬┘├┤ │◉│ ╠═╝│ │├┬┘ │ ├─┤│ printf '║%6s%s%8s║\n' '' '╦ ┬┌┐ ┬─┐┌─┐ ╭─╮ ╔═╗┌─┐┬─┐┌┬┐┌─┐┬' ''
╩═╝┴└─┘┴└─└─┘ ╨─╨ ╩ └─┘┴└─ ┴ ┴ ┴┴─┘" printf '║%6s%s%8s║\n' '' '║ │├┴┐├┬┘├┤ │◉│ ╠═╝│ │├┬┘ │ ├─┤│' ''
echo "" printf '║%6s%s%6s║\n' '' '╩═╝┴└─┘┴└─└─┘ ╨─╨ ╩ └─┘┴└─ ┴ ┴ ┴┴─┘' ''
printf '╚%s╝\n\n' "$hbar"
} }
init_action="$1" init_action="$1"
@ -61,19 +62,17 @@ checkSuccess() {
isHeader() { isHeader() {
local title="$1" local title="$1"
local width=52 local width=52
local inner=$((width - 6)) local inner=$((width - 2))
local title_len=${#title} local title_len=${#title}
local total_pad=$((inner - title_len)) local total_pad=$((inner - title_len))
if (( total_pad < 0 )); then total_pad=0; fi if (( total_pad < 0 )); then total_pad=0; fi
local left_pad=$((total_pad / 2)) local left_pad=$((total_pad / 2))
local right_pad=$((total_pad - left_pad)) local right_pad=$((total_pad - left_pad))
local bar local hbar
bar=$(printf '%*s' "$width" '' | tr ' ' '#') hbar=$(printf '═%.0s' $(seq 1 "$inner"))
echo "" printf '\n╔%s╗\n' "$hbar"
echo "$bar" printf '║%*s%s%*s║\n' "$left_pad" '' "$title" "$right_pad" ''
printf '###%*s%s%*s###\n' "$left_pad" '' "$title" "$right_pad" '' printf '╚%s╝\n\n' "$hbar"
echo "$bar"
echo ""
} }
# Original parameters for backward compatibility # Original parameters for backward compatibility

View File

@ -46,18 +46,18 @@ function isHeader()
{ {
local title="$1" local title="$1"
local width=52 local width=52
local inner=$((width - 6)) local inner=$((width - 2))
local title_len=${#title} local title_len=${#title}
local total_pad=$((inner - title_len)) local total_pad=$((inner - title_len))
if (( total_pad < 0 )); then total_pad=0; fi if (( total_pad < 0 )); then total_pad=0; fi
local left_pad=$((total_pad / 2)) local left_pad=$((total_pad / 2))
local right_pad=$((total_pad - left_pad)) local right_pad=$((total_pad - left_pad))
local bar # Double-line box. printf-repeat the horizontal rule so it stays aligned
bar=$(printf '%*s' "$width" '' | tr ' ' '#') # regardless of locale (tr can't emit a multibyte char per input byte).
local hbar
hbar=$(printf '═%.0s' $(seq 1 "$inner"))
echo "" printf '\n╔%s╗\n' "$hbar"
echo "$bar" printf '║%*s%s%*s║\n' "$left_pad" '' "$title" "$right_pad" ''
printf '###%*s%s%*s###\n' "$left_pad" '' "$title" "$right_pad" '' printf '╚%s╝\n\n' "$hbar"
echo "$bar"
echo ""
} }

View File

@ -24,25 +24,24 @@ isNotice() { echo -e "${YELLOW}NOTICE:${NC} $1"; }
isHeader() { isHeader() {
local title="$1" local title="$1"
local width=52 local width=52
local inner=$((width - 6)) local inner=$((width - 2))
local total_pad=$((inner - ${#title})) local total_pad=$((inner - ${#title}))
(( total_pad < 0 )) && total_pad=0 (( total_pad < 0 )) && total_pad=0
local left_pad=$((total_pad / 2)) local left_pad=$((total_pad / 2))
local right_pad=$((total_pad - left_pad)) local right_pad=$((total_pad - left_pad))
local bar local hbar
bar=$(printf '%*s' "$width" '' | tr ' ' '#') hbar=$(printf '═%.0s' $(seq 1 "$inner"))
echo "" printf '\n╔%s╗\n' "$hbar"
echo "$bar" printf '║%*s%s%*s║\n' "$left_pad" '' "$title" "$right_pad" ''
printf '###%*s%s%*s###\n' "$left_pad" '' "$title" "$right_pad" '' printf '╚%s╝\n\n' "$hbar"
echo "$bar"
echo ""
} }
echo " hbar=$(printf '═%.0s' $(seq 1 50))
╦ ┬┌┐ ┬─┐┌─┐ ╭─╮ ╔═╗┌─┐┬─┐┌┬┐┌─┐┬ printf '\n╔%s╗\n' "$hbar"
║ │├┴┐├┬┘├┤ │◉│ ╠═╝│ │├┬┘ │ ├─┤│ printf '║%6s%s%8s║\n' '' '╦ ┬┌┐ ┬─┐┌─┐ ╭─╮ ╔═╗┌─┐┬─┐┌┬┐┌─┐┬' ''
╩═╝┴└─┘┴└─└─┘ ╨─╨ ╩ └─┘┴└─ ┴ ┴ ┴┴─┘" printf '║%6s%s%8s║\n' '' '║ │├┴┐├┬┘├┤ │◉│ ╠═╝│ │├┬┘ │ ├─┤│' ''
echo "" printf '║%6s%s%6s║\n' '' '╩═╝┴└─┘┴└─└─┘ ╨─╨ ╩ └─┘┴└─ ┴ ┴ ┴┴─┘' ''
printf '╚%s╝\n\n' "$hbar"
isHeader "Regenerating Array Files" isHeader "Regenerating Array Files"
isNotice "Scanning scripts/ for subfolder arrays..." isNotice "Scanning scripts/ for subfolder arrays..."

View File

@ -12,11 +12,12 @@ initial_command7="$7"
displayLibrePortalLogo() displayLibrePortalLogo()
{ {
[[ "$LIBREPORTAL_SKIP_LOGO" == "1" ]] && return [[ "$LIBREPORTAL_SKIP_LOGO" == "1" ]] && return
echo " local hbar; hbar=$(printf '═%.0s' $(seq 1 50))
╦ ┬┌┐ ┬─┐┌─┐ ╭─╮ ╔═╗┌─┐┬─┐┌┬┐┌─┐┬ printf '\n╔%s╗\n' "$hbar"
║ │├┴┐├┬┘├┤ │◉│ ╠═╝│ │├┬┘ │ ├─┤│ printf '║%6s%s%8s║\n' '' '╦ ┬┌┐ ┬─┐┌─┐ ╭─╮ ╔═╗┌─┐┬─┐┌┬┐┌─┐┬' ''
╩═╝┴└─┘┴└─└─┘ ╨─╨ ╩ └─┘┴└─ ┴ ┴ ┴┴─┘" printf '║%6s%s%8s║\n' '' '║ │├┴┐├┬┘├┤ │◉│ ╠═╝│ │├┬┘ │ ├─┤│' ''
echo "" printf '║%6s%s%6s║\n' '' '╩═╝┴└─┘┴└─└─┘ ╨─╨ ╩ └─┘┴└─ ┴ ┴ ┴┴─┘' ''
printf '╚%s╝\n\n' "$hbar"
} }
showRunHelp() showRunHelp()