librelad f7240cd096 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>
2026-05-22 11:50:45 +01:00

64 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
function isSuccessful()
{
echo -e "${GREEN}SUCCESS:${NC} $1"
}
function isError()
{
echo -e "${RED}ERROR:${NC} $1"
}
function isFatalError()
{
echo -e "${RED}ERROR:${NC} $1"
}
function isFatalErrorExit()
{
echo -e "${RED}ERROR:${NC} $1"
echo ""
exit 1
}
function isNotice()
{
echo -e "${YELLOW}NOTICE:${NC} $1"
}
function isQuestion()
{
echo -e -n "${BLUE}QUESTION:${NC} $1 "
}
function isOptionMenu()
{
echo -e -n "${PINK}OPTION:${NC} $1"
}
function isOption()
{
echo -e "${PINK}OPTION:${NC} $1"
}
function isHeader()
{
local title="$1"
local width=52
local inner=$((width - 2))
local title_len=${#title}
local total_pad=$((inner - title_len))
if (( total_pad < 0 )); then total_pad=0; fi
local left_pad=$((total_pad / 2))
local right_pad=$((total_pad - left_pad))
# Double-line box. printf-repeat the horizontal rule so it stays aligned
# regardless of locale (tr can't emit a multibyte char per input byte).
local hbar
hbar=$(printf '═%.0s' $(seq 1 "$inner"))
printf '\n╔%s╗\n' "$hbar"
printf '║%*s%s%*s║\n' "$left_pad" '' "$title" "$right_pad" ''
printf '╚%s╝\n\n' "$hbar"
}