2023-02-05 00:09:07 -08:00
|
|
|
{{- if (ne .host.distro.family "windows") -}}
|
2022-11-22 06:06:20 -08:00
|
|
|
#!/usr/bin/env bash
|
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.
|
2022-11-22 06:06:20 -08:00
|
|
|
|
2022-12-01 22:54:58 -08:00
|
|
|
# .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 }}
|
2022-11-22 06:06:20 -08:00
|
|
|
|
2022-12-25 00:30:40 -08:00
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg
Deleted dotfiles/.local/share/chezmoi/home/run_onchange_after_bash-completions, dotfiles/.local/share/chezmoi/home/run_once_before_install-software.sh.tmpl
2022-11-24 06:18:43 -08:00
|
|
|
|
2023-11-04 18:46:18 -07:00
|
|
|
logg 'Updating the ~/.local/share/bash-completion/completions folder based on the installed applications'
|
2022-11-23 23:58:18 -08:00
|
|
|
|
2023-01-24 19:41:05 -08:00
|
|
|
if [ "$DEBUG_MODE" == 'true' ]; then
|
|
|
|
set +x
|
|
|
|
fi
|
2023-12-05 19:16:31 -08:00
|
|
|
set +x
|
2023-01-24 19:41:05 -08:00
|
|
|
|
2022-11-22 06:06:20 -08:00
|
|
|
### Initialize
|
2023-08-07 22:29:21 -07:00
|
|
|
COMPLETION_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions"
|
2022-11-22 06:06:20 -08:00
|
|
|
mkdir -p "$COMPLETION_DIR"
|
|
|
|
|
2023-03-26 23:57:26 -07:00
|
|
|
### Aqua
|
2023-07-17 23:35:49 -07:00
|
|
|
if command -v aqua > /dev/null; then
|
2023-03-26 23:57:26 -07:00
|
|
|
aqua completion bash > "$COMPLETION_DIR/aqua.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/aqua.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/aqua.bash"
|
2023-03-26 23:57:26 -07:00
|
|
|
fi
|
|
|
|
|
2022-11-22 06:06:20 -08:00
|
|
|
### Deno
|
|
|
|
if command -v deno > /dev/null; then
|
|
|
|
deno completions bash > "$COMPLETION_DIR/deno.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/deno.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/deno.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### direnv
|
|
|
|
if command -v direnv > /dev/null; then
|
|
|
|
direnv hook bash > "$COMPLETION_DIR/direnv.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/direnv.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/direnv.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### fd
|
|
|
|
if command -v fd > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix fd)/etc/bash_completion.d/fd" ]; then
|
2023-07-17 23:35:49 -07:00
|
|
|
cp -f "$(brew --prefix fd)/etc/bash_completion.d/fd" "$COMPLETION_DIR/fd.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
elif [ -f "$COMPLETION_DIR/fd.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/fd.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### fig
|
|
|
|
if command -v fig > /dev/null; then
|
|
|
|
fig completion bash > "$COMPLETION_DIR/fig.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/fig.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/fig.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### fzf
|
|
|
|
if command -v fzf > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix fzf)/shell/completion.bash" ]; then
|
2023-07-17 23:35:49 -07:00
|
|
|
cp -f "$(brew --prefix fzf)/shell/completion.bash" "$COMPLETION_DIR/fzf.bash"
|
|
|
|
cp -f "$(brew --prefix fzf)/shell/key-bindings.bash" "$COMPLETION_DIR/fzf-key-bindings.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
elif [ -f "$COMPLETION_DIR/fzf.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/fzf.bash"
|
|
|
|
rm -f "$COMPLETION_DIR/fzf-key-bindings.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
2023-08-06 22:19:59 -07:00
|
|
|
### fuck
|
|
|
|
if command -v fuck > /dev/null; then
|
|
|
|
thefuck --alias > "$COMPLETION_DIR/thefuck.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/thefuck.bash" ]; then
|
|
|
|
rm -f "$COMPLETION_DIR/thefuck.bash"
|
|
|
|
fi
|
|
|
|
|
2022-11-22 06:06:20 -08:00
|
|
|
### gh
|
|
|
|
if command -v gh > /dev/null; then
|
|
|
|
gh completion -s bash > "$COMPLETION_DIR/gh.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/gh.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/gh.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
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
|
2023-07-17 23:35:49 -07:00
|
|
|
cp -f "$(brew --prefix googler)/etc/bash_completion.d/googler-completion.bash" "$COMPLETION_DIR/googler.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
elif [ -f "$COMPLETION_DIR/googler.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/googler.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
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
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/gradle.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### Helm
|
|
|
|
if command -v helm > /dev/null; then
|
|
|
|
helm completion bash > "$COMPLETION_DIR/helm.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/helm.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/helm.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
2023-08-06 22:19:59 -07:00
|
|
|
### Hoard
|
|
|
|
if command -v hoard > /dev/null; then
|
|
|
|
hoard shell-config --shell bash > "$COMPLETION_DIR/hoard.bash"
|
|
|
|
hoard shell-config --shell zsh > "$COMPLETION_DIR/hoard.zsh"
|
|
|
|
elif [ -f "$COMPLETION_DIR/hoard.bash" ]; then
|
|
|
|
rm -f "$COMPLETION_DIR/hoard.bash"
|
|
|
|
rm -rf "$COMPLETION_DIR/hoard.zsh"
|
|
|
|
fi
|
|
|
|
|
2022-11-22 06:06:20 -08:00
|
|
|
### Hyperfine
|
|
|
|
if command -v hyperfine > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" ]; then
|
2023-07-17 23:35:49 -07:00
|
|
|
cp -f "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" "$COMPLETION_DIR/hyperfine.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
elif [ -f "$COMPLETION_DIR/hyperfine.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/hyperfine.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### kubectl
|
|
|
|
if command -v kubectl > /dev/null; then
|
|
|
|
kubectl completion bash > "$COMPLETION_DIR/kubectl.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/kubectl.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/kubectl.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
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
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/mcfly.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### nb
|
|
|
|
if command -v nb > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix nb)/etc/bash_completion.d/nb.bash" ]; then
|
2023-07-17 23:35:49 -07:00
|
|
|
cp -f "$(brew --prefix nb)/etc/bash_completion.d/nb.bash" "$COMPLETION_DIR/nb.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
elif [ -f "$COMPLETION_DIR/nb.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/nb.bash"
|
|
|
|
fi
|
|
|
|
|
|
|
|
### Ngrok
|
|
|
|
if command -v ngrok > /dev/null; then
|
|
|
|
ngrok completion > "$COMPLETION_DIR/ngrok.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/ngrok.bash" ]; then
|
|
|
|
rm -f "$COMPLETION_DIR/ngrok.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
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
|
2023-07-17 23:35:49 -07:00
|
|
|
cp -f "$(brew --prefix nnn)/etc/bash_completion.d/nnn-completion.bash" "$COMPLETION_DIR/nnn.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
elif [ -f "$COMPLETION_DIR/nnn.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/nnn.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### npm
|
|
|
|
if command -v npm > /dev/null; then
|
|
|
|
npm completion > "$COMPLETION_DIR/npm.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/npm.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/npm.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
2023-05-14 18:52:38 -07:00
|
|
|
### Please
|
|
|
|
if command -v plz > /dev/null; then
|
|
|
|
plz --completion_script > "$COMPLETION_DIR/please.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/please.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/please.bash"
|
2023-05-14 18:52:38 -07:00
|
|
|
fi
|
|
|
|
|
2023-05-29 20:55:26 -07:00
|
|
|
### Portal
|
|
|
|
if command -v portal > /dev/null; then
|
|
|
|
portal completion bash > "$COMPLETION_DIR/portal.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/portal.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/portal.bash"
|
2023-05-29 20:55:26 -07:00
|
|
|
fi
|
|
|
|
|
2022-11-22 06:06:20 -08:00
|
|
|
### Poetry
|
|
|
|
if command -v poetry > /dev/null; then
|
|
|
|
poetry completions bash > "$COMPLETION_DIR/poetry.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/poetry.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/poetry.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
2023-01-25 23:08:57 -08:00
|
|
|
### Sake
|
|
|
|
if command -v sake > /dev/null; then
|
|
|
|
sake completion bash > "$COMPLETION_DIR/sake.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/sake.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/sake.bash"
|
2023-01-25 23:08:57 -08:00
|
|
|
fi
|
|
|
|
|
2022-11-22 06:06:20 -08:00
|
|
|
### Volta
|
|
|
|
if command -v volta > /dev/null; then
|
|
|
|
volta completions bash > "$COMPLETION_DIR/volta.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/volta.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/volta.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
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
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/wp.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### zoxide
|
2023-07-17 23:35:49 -07:00
|
|
|
if command -v zoxide > /dev/null; then
|
2022-11-22 06:06:20 -08:00
|
|
|
zoxide init bash > "$COMPLETION_DIR/zoxide.bash"
|
|
|
|
elif [ -f "$COMPLETION_DIR/zoxide.bash" ]; then
|
2023-06-09 21:49:29 -07:00
|
|
|
rm -f "$COMPLETION_DIR/zoxide.bash"
|
2022-11-22 06:06:20 -08:00
|
|
|
fi
|
2023-02-05 00:09:07 -08:00
|
|
|
|
|
|
|
{{ end -}}
|