Skip to content

Commit

Permalink
Changed default of KREW_ROOT to avoid $HOME/.krew being used when run…
Browse files Browse the repository at this point in the history
…ning chezmoi for the first time
  • Loading branch information
jwnmulder committed Oct 1, 2024
1 parent 7c771d4 commit fdf5dd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

set -euo pipefail

KREW_ROOT="${KREW_ROOT:-$XDG_DATA_HOME/krew}"

{{ if not (stat (joinPath .chezmoi.homeDir ".local/share/krew/bin/kubectl-krew")) }}
(
cd "$(mktemp -d)" &&
Expand All @@ -15,6 +17,7 @@ set -euo pipefail
)
{{ end -}}

"${KREW_ROOT:-$HOME/.krew}"/bin/kubectl-krew install {{ .kubectl_krew_plugins | join " " }} 2>&1 | grep -v "Installing plugin"

"$KREW_ROOT"/bin/kubectl-krew install {{ .kubectl_krew_plugins | join " " }} 2>&1 | grep -v "Installing plugin"

{{ end -}}
6 changes: 3 additions & 3 deletions home/dot_profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ if [ -d "$HOME/.config/shellrc/profile.d" ]; then
fi

{{ if .is_desktop -}}
# Set PATH to include ~/.local/share/krew/bin or ~/.krew/bin if it exists
if [ -d "${KREW_ROOT:-$HOME/.krew}"/bin ]; then
PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# Set PATH to include ~/.local/share/krew/bin or something else if it exists
if [ -d "${KREW_ROOT:-"$XDG_DATA_HOME"/krew}"/bin ]; then
PATH="${KREW_ROOT:-$XDG_DATA_HOME/krew}/bin:$PATH"
fi
{{- end }}

Expand Down

0 comments on commit fdf5dd7

Please sign in to comment.