Files
CISS.debian.installer/func/helper/1083_helper_print.sh
Marc S. Weidner c026d9a324
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 39s
V8.00.000.2025.06.17
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
2025-07-24 23:01:23 +02:00

52 lines
1.8 KiB
Bash

#!/bin/bash
# SPDX-Version: 3.0
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.git
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
guard_sourcing
#######################################
# Wrapper around 'printf' for clean code.
# Globals:
# RES
# Arguments:
# 1: One of "${BLA}" | "${RED}" | "${GRE}" | "${YEL}" | "${BLU}" | "${MAG}" | "${CYA}" | "${WHI}"
# 2: Text string to print on terminal.
#######################################
do_print_color() {
printf "%s\n" "${1}${2}${RES}"
}
#######################################
# Wrapper around 'printf' for clean, uniform terminal output and line fold for long text strings for better readability.
# Globals:
# RES
# Arguments:
# 1: One of "${BLA}" | "${RED}" | "${GRE}" | "${YEL}" | "${BLU}" | "${MAG}" | "${CYA}" | "${WHI}"
# 2: Text string to print on terminal.
#######################################
do_print_fold() {
declare var_color="$1"; shift
declare var_msg_string="$*"
declare var_formatted_string="${var_color}${var_msg_string}${RES}"
# shellcheck disable=SC2312
printf "%b\n" "${var_formatted_string}" | fold -s -w 76 | sed '1! s/^/ /'
}
#######################################
# Wrapper around 'printf' for logfile redirect.
# Arguments:
# 1: Text string to redirect to a log file.
#######################################
do_print_log() {
printf "%s\n" "${1}"
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh