Better Layout of messages

This commit is contained in:
m8in
2026-06-22 01:55:40 +02:00
parent 7ff568de1d
commit 8044d776d8
3 changed files with 23 additions and 18 deletions
+11 -7
View File
@@ -216,17 +216,21 @@ function base.abort() {
&& exit 1
[ "${1:+isset}" != "isset" ] \
&& base.printWithColor LIGHTRED "\nScript ${CIS[SCRIPTNAME]} aborted!\n\n" >&2 \
&& base.printWithColor LIGHTRED "\nABORT (" >&2 \
&& base.printWithColor WHITE " ${CIS[SCRIPTNAME]}" >&2 \
&& base.printWithColor LIGHTRED ")!\n\n" >&2 \
&& exit 1
[ "${2:+isset}" != "isset" ] \
&& base.printWithColor LIGHTRED "\nScript ${CIS[SCRIPTNAME]} aborted!\n" >&2 \
&& base.printWithColor WHITE "${1:?"Missing parameter MESSAGE."}\n\n" >&2 \
&& base.printWithColor LIGHTRED "\nABORT (" >&2 \
&& base.printWithColor WHITE "${CIS[SCRIPTNAME]}" >&2 \
&& base.printWithColor LIGHTRED "): ${1:?"Missing parameter MESSAGE."}\n\n" >&2 \
&& exit 1
base.printWithColor LIGHTRED "\nScript ${CIS[SCRIPTNAME]} aborted!\n" >&2
base.printWithColor WHITE "${1:?"Missing parameter MESSAGE."}\n" >&2
base.printWithColor CYAN "TIP: ${2:?"Missing parameter TIP."}:\n" >&2
base.printWithColor LIGHTRED "\nABORT (" >&2
base.printWithColor WHITE "${CIS[SCRIPTNAME]}" >&2
base.printWithColor LIGHTRED "): ${1:?"Missing parameter MESSAGE."}\n" >&2
base.printWithColor YELLOW "Reason: ${2:?"Missing parameter REASON."}\n" >&2
while [ -n "${3}" ]; do
base.printWithColor LIGHTGREY " ${3:-""}\n" >&2
shift
@@ -460,7 +464,7 @@ elif [ "${CIS[SET]}" == "ready" ]; then
base.abort "Module '${BASH_SOURCE[0]}' already loaded."
else
# If not exists, define a global array 'COLOR'
trap "base.abort ' User-initiated termination.'" INT \
trap "base.abort 'User-initiated termination.'" INT \
&& declare -A -g COLOR=([SET]=unprepared) \
&& prepare.setCOLOR \
&& prepare.setPATH "/bin/grep" \