diff options
-rwxr-xr-x | common/files/init | 11 |
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> |