about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-04-02 14:05:21 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-04-02 14:05:21 +0200
commitfa92afbf1edc7fabaa1321dd9a3483dc73d24bf0 (patch)
treef3602bfdc7c76e57afbf898a0aecfd985e4bc973
parentfeat(treewide): Also remove hard-coded values in the `templates/` dir (diff)
downloadflake-templates-fa92afbf1edc7fabaa1321dd9a3483dc73d24bf0.tar.gz
flake-templates-fa92afbf1edc7fabaa1321dd9a3483dc73d24bf0.zip
feat(common/init): Add support for replacing the variables in file names
Diffstat (limited to '')
-rwxr-xr-xcommon/files/init6
-rw-r--r--templates/awk/src/%INIT_APPLICATION_NAME.awk (renamed from templates/awk/src/TODO.awk)0
2 files changed, 6 insertions, 0 deletions
diff --git a/common/files/init b/common/files/init
index 4f108ef..8e3479f 100755
--- a/common/files/init
+++ b/common/files/init
@@ -79,6 +79,12 @@ while read -r var; do
     var_value="${var_value%\"}"
 
     fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|"
+
+    # Replace the variable in file paths
+    fd "%INIT_$var_name" . --hidden | while read -r file_path; do
+        new_file_path="$(echo "$file_path" | sed "s|%INIT_$var_name|$var_value|")";
+        mv "$file_path" "$new_file_path"
+    done
 done < "$replacement_file"
 
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
diff --git a/templates/awk/src/TODO.awk b/templates/awk/src/%INIT_APPLICATION_NAME.awk
index 78b2356..78b2356 100644
--- a/templates/awk/src/TODO.awk
+++ b/templates/awk/src/%INIT_APPLICATION_NAME.awk