From 2e2c1a77f7712fa0a5620aaafbd12b2050d0fb9a Mon Sep 17 00:00:00 2001 From: Jamie Albert Date: Sat, 1 Nov 2025 02:36:34 +0000 Subject: [PATCH] stage: lib file --- libs/lib_output.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 libs/lib_output.sh diff --git a/libs/lib_output.sh b/libs/lib_output.sh new file mode 100644 index 0000000..7a25273 --- /dev/null +++ b/libs/lib_output.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# --- +# @file_name: jalibs.sh +# @version: 1.0.0 +# @description: lib files +# @author: Jamie Albert (empty_produce) +# @author_contact: +# @license: GNU Affero General Public License v3.0 (Included in LICENSE) +# Copyright (C) 2025, Jamie Albert +# --- +set -euo pipefail + +# --- +# Output +# --- + +text::error() { + declare error_msg exit_code="$1" + shift + printf -v error_msg 'error[%d]: %s\n' "$exit_code" "$*" + printf '%s' "$error_msg" >&2 + exit "${exit_code}" +} + +text::info() { + declare info_msg + printf -v info_msg '%s\n' "$*" + printf '%s' "$info_msg" +}