about summary refs log tree commit diff stats
path: root/update_common_files.sh
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-04-01 12:46:23 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-04-01 12:47:48 +0200
commit38f0b95ff7d89d51687018d37de106fabc49fdb6 (patch)
tree9b700bb9fd8d73b9f08f3c85e71512e75126da0c /update_common_files.sh
parentchore(version): v0.3.0 (diff)
downloadflake-templates-38f0b95ff7d89d51687018d37de106fabc49fdb6.tar.gz
flake-templates-38f0b95ff7d89d51687018d37de106fabc49fdb6.zip
refactor(treewide): Add a script to instantiate symlinks
Diffstat (limited to '')
-rwxr-xr-xupdate_common_files.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/update_common_files.sh b/update_common_files.sh
new file mode 100755
index 0000000..f342850
--- /dev/null
+++ b/update_common_files.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+
+ROOT="$(git rev-parse --show-toplevel)";
+
+# This results in fd returning relative paths
+cd "$ROOT/common" || echo "BUG, no root dir!"
+
+fd . "." --type file --hidden | while read -r file; do
+    echo "Instantiating '$file'..."
+    fd . "../templates" --type directory --max-depth 1 | while read -r template; do
+        echo "   done in '$template'."
+        echo "  " cp "$file" "$template$file"
+        rm "$template$file"
+        cp "$file" "$template$file"
+    done
+done
+
+
+# vim: ft=sh