Google Cloud SDK dotfiles

This commit is contained in:
Brian Zalewski 2023-06-04 07:46:31 +00:00
parent b3c333343b
commit f89f9f3283
3 changed files with 13 additions and 21 deletions

View file

@ -21,7 +21,6 @@ fi
### Initialize
COMPLETION_DIR="$HOME/.local/share/bash-completion/completions"
mkdir -p "$COMPLETION_DIR"
FALLBACK_URL="https://gitlab.com/megabyte-labs/misc/dotfiles/-/raw/master/dotfiles/.local/share/bash-completion/completions"
### Aqua
if command -v aqua &> /dev/null; then
@ -47,8 +46,6 @@ fi
### fd
if command -v fd > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix fd)/etc/bash_completion.d/fd" ]; then
cp "$(brew --prefix fd)/etc/bash_completion.d/fd" "$COMPLETION_DIR/fd.bash"
elif command -v fd > /dev/null; then
curl -sSL "$FALLBACK_URL/fd.bash" > "$COMPLETION_DIR/fd.bash"
elif [ -f "$COMPLETION_DIR/fd.bash" ]; then
rm "$COMPLETION_DIR/fd.bash"
fi
@ -64,9 +61,6 @@ fi
if command -v fzf > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix fzf)/shell/completion.bash" ]; then
cp "$(brew --prefix fzf)/shell/completion.bash" "$COMPLETION_DIR/fzf.bash"
cp "$(brew --prefix fzf)/shell/key-bindings.bash" "$COMPLETION_DIR/fzf-key-bindings.bash"
elif command -v fzf > /dev/null; then
curl -sSL "$FALLBACK_URL/fzf.bash" > "$COMPLETION_DIR/fzf.bash"
curl -sSL "$FALLBACK_URL/fzf-key-bindings.bash" > "$COMPLETION_DIR/fzf-key-bindings.bash"
elif [ -f "$COMPLETION_DIR/fzf.bash" ]; then
rm "$COMPLETION_DIR/fzf.bash"
rm "$COMPLETION_DIR/fzf-key-bindings.bash"
@ -79,18 +73,9 @@ elif [ -f "$COMPLETION_DIR/gh.bash" ]; then
rm "$COMPLETION_DIR/gh.bash"
fi
### Google Cloud SDK
if command -v gcloud > /dev/null; then
curl -sSL "$FALLBACK_URL/gcloud.bash" > "$COMPLETION_DIR/gcloud.bash"
elif [ -f "$COMPLETION_DIR/gcloud.bash" ]; then
rm "$COMPLETION_DIR/gcloud.bash"
fi
### Googler
if command -v googler > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix googler)/etc/bash_completion.d/googler-completion.bash" ]; then
cp "$(brew --prefix googler)/etc/bash_completion.d/googler-completion.bash" "$COMPLETION_DIR/googler.bash"
elif command -v googler > /dev/null; then
curl -sSL "$FALLBACK_URL/googler.bash" > "$COMPLETION_DIR/googler.bash"
elif [ -f "$COMPLETION_DIR/googler.bash" ]; then
rm "$COMPLETION_DIR/googler.bash"
fi
@ -112,8 +97,6 @@ fi
### Hyperfine
if command -v hyperfine > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" ]; then
cp "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" "$COMPLETION_DIR/hyperfine.bash"
elif command -v hyperfine > /dev/null; then
curl -sSL "$FALLBACK_URL/hyperfine.bash" > "$COMPLETION_DIR/hyperfine.bash"
elif [ -f "$COMPLETION_DIR/hyperfine.bash" ]; then
rm "$COMPLETION_DIR/hyperfine.bash"
fi
@ -136,8 +119,6 @@ fi
### nb
if command -v nb > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix nb)/etc/bash_completion.d/nb.bash" ]; then
cp "$(brew --prefix nb)/etc/bash_completion.d/nb.bash" "$COMPLETION_DIR/nb.bash"
elif command -v nb > /dev/null; then
curl -sSL "$FALLBACK_URL/nb.bash" > "$COMPLETION_DIR/nb.bash"
elif [ -f "$COMPLETION_DIR/nb.bash" ]; then
rm "$COMPLETION_DIR/nb.bash"
fi
@ -145,8 +126,6 @@ fi
### nnn
if command -v nnn > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix nnn)/etc/bash_completion.d/nnn-completion.bash" ]; then
cp "$(brew --prefix nnn)/etc/bash_completion.d/nnn-completion.bash" "$COMPLETION_DIR/nnn.bash"
elif command -v nnn > /dev/null; then
curl -sSL "$FALLBACK_URL/nnn.bash" > "$COMPLETION_DIR/nnn.bash"
elif [ -f "$COMPLETION_DIR/nnn.bash" ]; then
rm "$COMPLETION_DIR/nnn.bash"
fi

View file

@ -86,6 +86,11 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
source <(cod init $$ bash)
fi
### Google Cloud SDK
if [ -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.bash.inc" ]; then
. "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.bash.inc"
fi
### direnv
if command -v direnv > /dev/null; then
eval "$(direnv hook bash)"

View file

@ -402,6 +402,14 @@ if command -v emplace > /dev/null; then
eval "$(emplace init zsh)"
fi
### Google Cloud SDK
if [ -f "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.zsh.inc" ]; then
source "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.zsh.inc"
fi
if [ -f "$HOMEBREW_PREFIX/share/google-cloud-sdk/completion.zsh.inc" ]; then
source "$HOMEBREW_PREFIX/share/google-cloud-sdk/completion.zsh.inc"
fi
### Java (asdf)
# if [ -f "$ASDF_DATA_DIR/plugins/java/set-java-home.zsh" ]; then
# . "$ASDF_DATA_DIR/plugins/java/set-java-home.zsh"