Files
template-engine-copier-3darch/example/.scripts/copier/lib/answers/-params-pull-and-merge.sh
T
root-at-skicandClaude Opus 5 97991021ff template-engine-copier skill: initial import
Copier + Jinja template-repository design skill: reference architecture,
implementation workflow, validation checklist, and a full worked example
template (questionnaire, extensions, resolvers, wrapper-first .scripts).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 22:30:29 +03:00

18 lines
651 B
Bash

#!/bin/bash
_copier_answers_params_pull_and_merge() {
[ -f "${HL_V1_COPIER_PARAMS_FILE}" ] || return 0
[ -f "${HL_V1_COPIER_FILE_COPIER_ANSWERS_NEW}" ] || return 0
if command -v yq >/dev/null 2>&1; then
local TMP_WORK_FILE="tmp-work-file.yml"
yq eval-all '. as $item ireduce ({}; . * $item)' \
"${HL_V1_COPIER_FILE_COPIER_ANSWERS_NEW}" \
"${HL_V1_COPIER_PARAMS_FILE}" >"${TMP_WORK_FILE}"
mv "${TMP_WORK_FILE}" "${HL_V1_COPIER_FILE_COPIER_ANSWERS_NEW}"
else
# Fallback: params file wins as full override when yq is unavailable.
cp "${HL_V1_COPIER_PARAMS_FILE}" "${HL_V1_COPIER_FILE_COPIER_ANSWERS_NEW}"
fi
}