Replace the ALLCAPS "SUCCESS:/NOTICE:/ERROR:/QUESTION:/OPTION:" prefixes with distinct per-status glyphs and calmer title-case words: ✓ Success ! Notice ✗ Error ❯ Question ❯ Option The portal chevron ❯ marks the interactive prompts. Distinct glyph + word stays readable with no colour and greppable in logs. Display-only; nothing parses these prefixes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
65 lines
1.3 KiB
Bash
Executable File
65 lines
1.3 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"
|
||
}
|
||
|
||
# Interactive markers use the portal chevron ❯ — the moments you "step through".
|
||
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"
|
||
}
|