V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m52s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-10-24 10:57:49 +01:00
parent fd60deb5b9
commit dcd3680077
138 changed files with 398 additions and 168 deletions

View File

@@ -16,23 +16,23 @@
# Globals:
# BASH_SOURCE
# Arguments:
# 1: Explicitly provided Argument: filename of the caller LIB. (Better let the guard_sourcing() determine dynamically.)
# 1: Explicitly provided Argument: filename of the caller LIB. (Better let the guard_sourcing || return "${ERR_GUARD_SOURCE}"() determine dynamically.)
# Returns:
# 0: Returns '0' in both cases as they are intended to be successful.
#######################################
guard_sourcing() {
guard_sourcing || return "${ERR_GUARD_SOURCE}"() {
### Determine the caller script (the library being sourced).
declare var_src="${1:-${BASH_SOURCE[1]}}"
declare var_src="${1:-${BASH_SOURCE[1]}}"
### Strip path, keep only the filename
declare var_file_name="${var_src##*/}"
declare var_file_name="${var_src##*/}"
### Sanitize to valid var name.
declare var_safe_name="${var_file_name//[^a-zA-Z0-9_]/_}"
declare var_safe_name="${var_file_name//[^a-zA-Z0-9_]/_}"
### Build guard-variable name.
declare var_guard_var="_${var_safe_name}_LOADED"
declare var_guard_var="_${var_safe_name}_LOADED"
### If already loaded, abort sourcing
if [[ -n "${!var_guard_var:-}" ]]; then
return 0
return "${ERR_GUARD_SOURCE}"
fi
### Mark as loaded (readonly + exported)
@@ -41,5 +41,5 @@ guard_sourcing() {
}
### Prevents accidental 'unset -f'.
# shellcheck disable=SC2034
readonly -f guard_sourcing
readonly -f guard_sourcing || return "${ERR_GUARD_SOURCE}"
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh