Skip to content

Commit c462c8d

Browse files
committed
Add force to mv in render_templates function
1 parent 6475632 commit c462c8d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

functions/render_templates.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ render_templates() {
55
command -v gomplate >/dev/null 2>&1 || { error "This function requires gomplate to be installed."; return 1; }
66

77
for item in "${@}"; do
8-
local item_dirname tempfile
9-
[[ -e "${item}" ]] || { error "File ${item} is missing."; return 1; }
10-
item_dirname="$(dirname "${item}")"
11-
tempfile="$(mktemp -p "${item_dirname}" -t .tmp.XXXXXXXXXX)"
8+
local item_dirname tempfile
9+
[[ -e "${item}" ]] || { error "File ${item} is missing."; return 1; }
10+
item_dirname="$(dirname "${item}")"
11+
tempfile="$(mktemp -p "${item_dirname}" -t .tmp.XXXXXXXXXX)"
1212
permissions="$(stat -c '%a' "${item}")"
1313

1414
(>&1 echo "Rendering template ${item}")
1515
gomplate < "${item}" > "${tempfile}" || { rm "${tempfile}" 2>/dev/null; error "Failed to render template ${item}."; return 1; }
16-
mv "${tempfile}" "${item/%\.tmpl/}"
16+
mv -f "${tempfile}" "${item/%\.tmpl/}"
1717
chmod "${permissions}" "${item/%\.tmpl/}"
1818

1919
if [[ "${DEBUG:-false}" == 'true' ]]; then

0 commit comments

Comments
 (0)