install.fairie/home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.sh.tmpl

197 lines
6.9 KiB
Cheetah
Raw Normal View History

{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
Update 55 files - /home/dot_config/rclone/system/s3-docker.service.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_13-post-install-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-warp.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_06-bin-symlink.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_40-firefox.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_27-tor.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_26-vscode-extensions.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_05-log-config.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_04-environment-profile.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-warp.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_20-font.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.sh.tmpl
2023-04-11 20:26:25 -07:00
# @file Bash Completions
# @brief Ensures bash completions are pre-generated and made available
# @description
# This script detects the presence of various executables with Bash completions available and then
# conditionally adds the completions to the Bash completions folder.
# .chezmoidata.yml hash: {{ include (joinPath .chezmoi.sourceDir ".chezmoidata.yaml")| sha256sum }}
Update .local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_set-wallpaper.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_once_before_1-decrypt-age-key.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, .local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl, .local/share/chezmoi/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl, .local/share/chezmoi/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_50-crontab.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-zsh-plugins.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_before_5-install-homebrew.tmpl, .local/share/chezmoi/home/.chezmoiscripts/windows/run_onchange_before_11-install-windows-packages.tmpl
2022-12-01 22:36:57 -08:00
# software.yml hash: {{ include (joinPath .chezmoi.homeDir ".local" "share" "chezmoi" "software.yml")| sha256sum }}
Update 19 files - /home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl - /home/.chezmoiscripts/universal/run_before_1-decrypt-age-key.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14_install-aqua-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-zsh-plugins.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl - /home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl - /home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl - /home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl - /home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl - /home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl - /home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-dependencies.tmpl - /home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl - /home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl - /home/.chezmoiscripts/_universal/run_onchange_before_5-install-homebrew.tmpl - /home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx.tmpl
2022-12-25 00:30:40 -08:00
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
logg 'Updating the `~/.local/share/bash-completion/completions` folder based on the installed applications'
if [ "$DEBUG_MODE" == 'true' ]; then
set +x
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
aqua completion bash > "$COMPLETION_DIR/aqua.bash"
elif [ -f "$COMPLETION_DIR/aqua.bash" ]; then
rm "$COMPLETION_DIR/aqua.bash"
fi
### Deno
if command -v deno > /dev/null; then
deno completions bash > "$COMPLETION_DIR/deno.bash"
elif [ -f "$COMPLETION_DIR/deno.bash" ]; then
rm "$COMPLETION_DIR/deno.bash"
fi
### direnv
if command -v direnv > /dev/null; then
direnv hook bash > "$COMPLETION_DIR/direnv.bash"
elif [ -f "$COMPLETION_DIR/direnv.bash" ]; then
rm "$COMPLETION_DIR/direnv.bash"
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
### fig
if command -v fig > /dev/null; then
fig completion bash > "$COMPLETION_DIR/fig.bash"
elif [ -f "$COMPLETION_DIR/fig.bash" ]; then
rm "$COMPLETION_DIR/fig.bash"
fi
### fzf
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"
fi
### gh
if command -v gh > /dev/null; then
gh completion -s bash > "$COMPLETION_DIR/gh.bash"
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
### Gradle
if command -v gradle > /dev/null; then
curl -sSL https://raw.githubusercontent.com/eriwen/gradle-completion/master/gradle-completion.bash > "$COMPLETION_DIR/gradle.bash"
elif [ -f "$COMPLETION_DIR/gradle.bash" ]; then
rm "$COMPLETION_DIR/gradle.bash"
fi
### Helm
if command -v helm > /dev/null; then
helm completion bash > "$COMPLETION_DIR/helm.bash"
elif [ -f "$COMPLETION_DIR/helm.bash" ]; then
rm "$COMPLETION_DIR/helm.bash"
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
### kubectl
if command -v kubectl > /dev/null; then
kubectl completion bash > "$COMPLETION_DIR/kubectl.bash"
elif [ -f "$COMPLETION_DIR/kubectl.bash" ]; then
rm "$COMPLETION_DIR/kubectl.bash"
fi
### mcfly
export MCFLY_KEY_SCHEME=vim
if command -v mcfly > /dev/null; then
mcfly init bash > "$COMPLETION_DIR/mcfly.bash"
elif [ -f "$COMPLETION_DIR/mcfly.bash" ]; then
rm "$COMPLETION_DIR/mcfly.bash"
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
### 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
### npm
if command -v npm > /dev/null; then
npm completion > "$COMPLETION_DIR/npm.bash"
elif [ -f "$COMPLETION_DIR/npm.bash" ]; then
rm "$COMPLETION_DIR/npm.bash"
fi
### Poetry
if command -v poetry > /dev/null; then
poetry completions bash > "$COMPLETION_DIR/poetry.bash"
elif [ -f "$COMPLETION_DIR/poetry.bash" ]; then
rm "$COMPLETION_DIR/poetry.bash"
fi
### Sake
if command -v sake > /dev/null; then
sake completion bash > "$COMPLETION_DIR/sake.bash"
elif [ -f "$COMPLETION_DIR/sake.bash" ]; then
rm "$COMPLETION_DIR/sake.bash"
fi
### Volta
if command -v volta > /dev/null; then
volta completions bash > "$COMPLETION_DIR/volta.bash"
elif [ -f "$COMPLETION_DIR/volta.bash" ]; then
rm "$COMPLETION_DIR/volta.bash"
fi
### wp-cli (only bash available)
if command -v wp > /dev/null; then
curl -sSL https://raw.githubusercontent.com/wp-cli/wp-cli/v2.7.1/utils/wp-completion.bash > "$COMPLETION_DIR/wp.bash"
elif [ -f "$COMPLETION_DIR/wp.bash" ]; then
rm "$COMPLETION_DIR/wp.bash"
fi
### zoxide
if command -v zoxide >/dev/null; then
zoxide init bash > "$COMPLETION_DIR/zoxide.bash"
elif [ -f "$COMPLETION_DIR/zoxide.bash" ]; then
rm "$COMPLETION_DIR/zoxide.bash"
fi
{{ end -}}