From e156adac77f2fa8f1d45f7ac29a7c2bff5fb13a3 Mon Sep 17 00:00:00 2001 From: Jack Rose Date: Thu, 25 Jan 2024 11:05:16 +1100 Subject: [PATCH 1/2] rename function, it's not just direnv stuff now --- scripts/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index ebf1ec0..17ddc44 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -74,7 +74,7 @@ install_direnv() { fi } -direnv_shell_integration() { +shell_integrations() { DIRENV_BIN="$(command -v direnv)" DIRENV_BIN="${DIRENV_BIN:-$HOME/.nix-profile/bin/direnv}" shell=$(basename "$SHELL") @@ -157,7 +157,7 @@ main() { install_nix install_devbox install_direnv - direnv_shell_integration + shell_integrations install_nix_direnv print_further_steps } From b03f742715d76aa1efe818ebdbc5494c1b3bf255 Mon Sep 17 00:00:00 2001 From: Jack Rose Date: Thu, 25 Jan 2024 11:07:40 +1100 Subject: [PATCH 2/2] insert a newline before rc config - this ensures no line concatenation if there is a missing newline at the end of the file --- scripts/bootstrap.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 17ddc44..b3be13c 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -81,7 +81,7 @@ shell_integrations() { case "$shell" in *bash*) rcfile="$HOME/.bashrc" - touch "$rcfile" + printf "\n" >>"$rcfile" cat <<-EOF >>"$rcfile" ### Do not edit. This was autogenerated by 'bootstrap.sh' ### export DIRENV_BIN="$DIRENV_BIN" @@ -91,7 +91,7 @@ shell_integrations() { ;; *zsh*) rcfile="${ZDOTDIR:-$HOME}/.zshrc" - touch "$rcfile" + printf "\n" >>"$rcfile" cat <<-EOF >>"$rcfile" ### Do not edit. This was autogenerated by 'bootstrap.sh' ### export DIRENV_BIN="$DIRENV_BIN" @@ -102,7 +102,7 @@ shell_integrations() { *fish*) rcfile="${XDG_DATA_HOME:-$HOME/.local/share}/fish/vendor_conf.d/direnv.fish" mkdir -p "$(dirname "$rcfile")" - touch "$rcfile" + printf "\n" >>"$rcfile" cat <<-EOF >>"$rcfile" ### Do not edit. This was autogenerated by 'bootstrap.sh' ### set -gx DIRENV_BIN "$DIRENV_BIN"