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>
36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
# -------------------------------------------------------------------------------------
|
|
# 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.
|
|
# -------------------------------------------------------------------------------------
|
|
|
|
prompt_for_env_var() {
|
|
local var_name="$1"
|
|
local function_name="${FUNCNAME[1]:-unknown_function}"
|
|
|
|
if [ -z "${!var_name}" ]; then
|
|
while true; do
|
|
_loggers_emptyLine
|
|
echo -e "Provide a value for ${var_name} environment variable!\n"
|
|
read -rep "> " tmp_value
|
|
|
|
if [ -n "${tmp_value}" ]; then
|
|
export "${var_name}=${tmp_value}"
|
|
export ENV_VAR_KEY="${var_name}"
|
|
export ENV_VAR_VALUE="${tmp_value}"
|
|
_base_localStorage_saveEnvVariable2_fileDotEnv
|
|
break
|
|
else
|
|
_loggers_emptyLine
|
|
_loggers_warn "${function_name}" "Provided value cannot be empty!"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
_loggers_debug "${function_name}" "${var_name}: *REDACTED*"
|
|
}
|
|
|