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>
42 lines
1.3 KiB
Bash
Executable File
42 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.
|
|
# -------------------------------------------------------------------------------------
|
|
set -e
|
|
|
|
. ./.scripts/loggers/lib/--index-api.sh
|
|
|
|
. ./.scripts/base/lib/local-storage/--index-api.sh
|
|
|
|
_base_ensureEnvVarIbmUserEmail() {
|
|
local FUNCTION_NAME="_base_ensureEnvVarIbmUserEmail"
|
|
|
|
local TMP_IBM_USER_EMAIL=""
|
|
if
|
|
[ -z "${IBM_USER_EMAIL}" ]
|
|
then
|
|
while
|
|
true
|
|
do
|
|
_loggers_emptyLine
|
|
read -rep $'Provide for IBM_USER_EMAIL environment variable! \n\n> ' TMP_IBM_USER_EMAIL
|
|
if
|
|
[ ! -z "${TMP_IBM_USER_EMAIL}" ]
|
|
then
|
|
export IBM_USER_EMAIL="${TMP_IBM_USER_EMAIL}"
|
|
export ENV_VAR_KEY="IBM_USER_EMAIL"
|
|
export ENV_VAR_VALUE="${IBM_USER_EMAIL}"
|
|
_base_localStorage_saveEnvVariable2_fileDotEnv
|
|
break
|
|
else
|
|
_loggers_emptyLine
|
|
_loggers_warn "${FUNCTION_NAME}" "Provided value can not be empty!"
|
|
fi
|
|
done
|
|
fi
|
|
_loggers_debug "${FUNCTION_NAME}" "IBM_USER_EMAIL: ${IBM_USER_EMAIL}"
|
|
}
|