Ports generic-scripts-module-v1 into a routed skill: module anatomy, shared loggers/base modules, Taskfile integration, workflows, and pattern decisions. Fixes a latent defect in the loggers example that silenced all logging in the module scaffold: loggers/lib/--index-api.sh now sources --env-vars-reader.sh, and the reader preserves already-exported values so caller overrides still win. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
41 lines
1.3 KiB
Bash
Executable File
41 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# -------------------------------------------------------------------------------------
|
|
# IBM Confidential
|
|
# 6949-70F, 6949-80D
|
|
# © Copyright IBM Corp. 2018, 2024
|
|
# US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
# -------------------------------------------------------------------------------------
|
|
|
|
. ./.scripts/loggers/lib/--index-api.sh
|
|
|
|
. ./.scripts/base/lib/local-storage/-ensure-existance-file.sh
|
|
|
|
. ./.scripts/base/lib/-export-env-variable.sh
|
|
|
|
. ./.scripts/base/lib/-get-env-variable-key-from-line.sh
|
|
. ./.scripts/base/lib/-get-env-variable-value-from-line.sh
|
|
|
|
_base_exportEnvVariablesFrom_file() {
|
|
local FUNCTION_NAME="_base_exportEnvVariablesFrom_file"
|
|
local FILE_RELATIVE_PATH=${1}
|
|
|
|
_loggers_trace "${FUNCTION_NAME}" "FILE_RELATIVE_PATH: ${FILE_RELATIVE_PATH}"
|
|
_base_localStorage_ensureExistance_file "${FILE_RELATIVE_PATH}"
|
|
|
|
while read TMP_FILE_ENV_LINE; do
|
|
if
|
|
[ ! -z "${TMP_FILE_ENV_LINE}" ]
|
|
then
|
|
|
|
local TMP_KEY=$(
|
|
_base_getEnvVariableKey_fromLine "${TMP_FILE_ENV_LINE}"
|
|
)
|
|
local TMP_VALUE=$(
|
|
_base_getEnvVariableValue_fromLine "${TMP_FILE_ENV_LINE}"
|
|
)
|
|
_base_exportEnvVariable "${TMP_KEY}" "${TMP_VALUE}"
|
|
|
|
fi
|
|
done <"${FILE_RELATIVE_PATH}"
|
|
}
|