aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-11 09:07:34 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-11 09:07:34 +0200
commit464cde4508622057b621d68e8970a2f881b08c3a (patch)
tree79f43238b21d464b6c71f7aa3aefb23b40baa3b5
parentfeat(templates/rust/Cargo.toml): Add the required meta-data for `crates.io` (diff)
downloadflake-templates-464cde4508622057b621d68e8970a2f881b08c3a.zip
style(common/init): Run through `nix fmt`
-rwxr-xr-xcommon/files/init11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/files/init b/common/files/init
index dd75fc3..3498d56 100755
--- a/common/files/init
+++ b/common/files/init
@@ -1,5 +1,6 @@
#!/usr/bin/env sh
+# shellcheck source=/dev/null
. "$(realpath "$(dirname "$0")")/shell_line_editor.sh"
replacement_file="$(mktemp)"
@@ -27,10 +28,10 @@ prompt() {
pr_ask="$4"
if [ -n "$pr_ask" ]; then
- REPLY="$pr_suggested_answer";
+ REPLY="$pr_suggested_answer"
else
printf "\033[94;1mEnter %s\033[0m" "$pr_variable_upper"
- if [ -n "$pr_description" ];then
+ if [ -n "$pr_description" ]; then
printf " (\033[93;1m%s\033[0m):\n" "$pr_description"
else
printf ":\n"
@@ -43,7 +44,7 @@ prompt() {
pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
eval "$pr_new_variable"
- printf "%s\n" "$pr_new_variable" >> "$replacement_file"
+ printf "%s\n" "$pr_new_variable" >>"$replacement_file"
}
git init
@@ -124,10 +125,10 @@ while read -r var; do
# 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|g")";
+ new_file_path="$(echo "$file_path" | sed "s|%INIT_$var_name|$var_value|g")"
mv "$file_path" "$new_file_path"
done
-done < "$replacement_file"
+done <"$replacement_file"
# HACK: Re-add the executable permissions to files, which the nix template has somehow
# removed <2024-04-02>