Update dotfiles/.local/share/bash-completion/generate.sh, dotfiles/.local/share/bash-completion/completions/google-cloud-sdk.bash
This commit is contained in:
parent
6db6386c4f
commit
37761ce0cf
2 changed files with 44 additions and 30 deletions
|
@ -1,5 +1,6 @@
|
||||||
_python_argcomplete() {
|
_python_argcomplete() {
|
||||||
local IFS=''
|
local IFS='
|
||||||
|
'
|
||||||
local prefix=
|
local prefix=
|
||||||
typeset -i n
|
typeset -i n
|
||||||
(( lastw=${#COMP_WORDS[@]} -1))
|
(( lastw=${#COMP_WORDS[@]} -1))
|
||||||
|
|
|
@ -1,101 +1,114 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
### Initialize
|
### Initialize
|
||||||
mkdir -p "$HOME/.local/share/bash-completion/completions"
|
COMPLETION_DIR="$XDG_DATA_HOME/bash-completion/completions"
|
||||||
|
mkdir -p "$COMPLETION_DIR"
|
||||||
|
FALLBACK_URL="https://gitlab.com/megabyte-labs/misc/dotfiles/-/raw/master/dotfiles/.local/share/bash-completion/completions"
|
||||||
|
|
||||||
### Deno
|
### Deno
|
||||||
if command -v deno > /dev/null; then
|
if command -v deno > /dev/null; then
|
||||||
deno completions bash > "$HOME/.local/share/bash-completion/completions/deno.bash"
|
deno completions bash > "$COMPLETION_DIR/deno.bash"
|
||||||
|
elif [ -f "$COMPLETION_DIR/deno.bash" ]; then
|
||||||
|
rm "$COMPLETION_DIR/deno.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### direnv
|
### direnv
|
||||||
if command -v direnv > /dev/null; then
|
if command -v direnv > /dev/null; then
|
||||||
direnv hook bash > "$HOME/.local/share/bash-completion/completions/direnv.bash"
|
direnv hook bash > "$COMPLETION_DIR/direnv.bash"
|
||||||
|
elif [ -f "$COMPLETION_DIR/direnv.bash" ]; then
|
||||||
|
rm "$COMPLETION_DIR/direnv.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### fd
|
### fd
|
||||||
if command -v fd > /dev/null && [ -f /usr/local/src/fd/autocomplete/fd.bash-completion ]; then
|
if command -v fd > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix fd)/etc/bash_completion.d/fd" ]; then
|
||||||
cp /usr/local/src/fd/autocomplete/fd.bash-completion "$HOME/.local/share/bash-completion/completions/fd.bash"
|
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
|
fi
|
||||||
|
|
||||||
### fig
|
### fig
|
||||||
if command -v fig > /dev/null; then
|
if command -v fig > /dev/null; then
|
||||||
fig completion bash > "$HOME/.local/share/bash-completion/completions/fig.bash"
|
fig completion bash > "$COMPLETION_DIR/fig.bash"
|
||||||
|
elif [ -f "$COMPLETION_DIR/fig.bash" ]; then
|
||||||
|
rm "$COMPLETION_DIR/fig.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### gh
|
### gh
|
||||||
if command -v gh > /dev/null; then
|
if command -v gh > /dev/null; then
|
||||||
gh completion -s bash > "$HOME/.local/share/bash-completion/completions/gh.bash"
|
gh completion -s bash > "$COMPLETION_DIR/gh.bash"
|
||||||
|
elif [ -f "$COMPLETION_DIR/gh.bash" ]; then
|
||||||
|
rm "$COMPLETION_DIR/gh.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Google Cloud SDK
|
### Google Cloud SDK
|
||||||
if command -v brew >/dev/null; then
|
if command -v gcloud > /dev/null && command -v brew > /dev/null; then
|
||||||
if [ -f "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" ]; then
|
if [ -f "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" ]; then
|
||||||
cat "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" > "$HOME/.local/share/bash-completion/completions/google-cloud-sdk.bash"
|
cat "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" > "$COMPLETION_DIR/google-cloud-sdk.bash"
|
||||||
fi
|
elif command -v
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Googler
|
### Googler
|
||||||
if command -v googler > /dev/null; then
|
if command -v googler > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix googler)/etc/bash_completion.d/googler-completion.bash" ]; then
|
||||||
if [ -f /usr/local/src/googler/googler-completion.bash ]; then
|
cp "$(brew --prefix googler)/etc/bash_completion.d/googler-completion.bash" "$COMPLETION_DIR/googler.bash"
|
||||||
cp /usr/local/src/googler/googler-completion.bash "$HOME/.local/share/bash-completion/completions/googler.bash"
|
elif command -v googler > /dev/null; then
|
||||||
fi
|
curl -sSL "$FALLBACK_URL/googler.bash" > "$COMPLETION_DIR/googler.bash"
|
||||||
if [ -f /usr/local/src/googler/googler_at ]; then
|
elif [ -f "$COMPLETION_DIR/googler.bash" ]; then
|
||||||
cp /usr/local/src/googler/googler_at "$HOME/.local/share/bash-completion/completions/googler-at.bash"
|
rm "$COMPLETION_DIR/googler.bash"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Gradle
|
### Gradle
|
||||||
if command -v gradle > /dev/null; then
|
if command -v gradle > /dev/null; then
|
||||||
curl -sSL https://raw.githubusercontent.com/eriwen/gradle-completion/master/gradle-completion.bash > "$HOME/.local/share/bash-completion/completions/gradle.bash"
|
curl -sSL https://raw.githubusercontent.com/eriwen/gradle-completion/master/gradle-completion.bash > "$COMPLETION_DIR/gradle.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Helm
|
### Helm
|
||||||
if command -v helm > /dev/null; then
|
if command -v helm > /dev/null; then
|
||||||
helm completion bash > "$HOME/.local/share/bash-completion/completions/helm.bash"
|
helm completion bash > "$COMPLETION_DIR/helm.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Hyperfine
|
### Hyperfine
|
||||||
if command -v hyperfine > /dev/null && command -v brew > /dev/null && [ -f "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" ]; then
|
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" "$HOME/.local/share/bash-completion/completions/hyperfine.bash"
|
cp "$(brew --prefix hyperfine)/etc/bash_completion.d/hyperfine.bash" "$COMPLETION_DIR/hyperfine.bash"
|
||||||
elif command -v hyperfine > /dev/null; then
|
elif command -v hyperfine > /dev/null; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### kubectl
|
### kubectl
|
||||||
if command -v kubectl > /dev/null; then
|
if command -v kubectl > /dev/null; then
|
||||||
kubectl completion bash > "$HOME/.local/share/bash-completion/completions/kubectl.bash"
|
kubectl completion bash > "$COMPLETION_DIR/kubectl.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### mcfly
|
### mcfly
|
||||||
export MCFLY_KEY_SCHEME=vim
|
export MCFLY_KEY_SCHEME=vim
|
||||||
if command -v mcfly > /dev/null; then
|
if command -v mcfly > /dev/null; then
|
||||||
mcfly init bash > "$HOME/.local/share/bash-completion/completions/mcfly.bash"
|
mcfly init bash > "$COMPLETION_DIR/mcfly.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### npm
|
### npm
|
||||||
if command -v npm > /dev/null; then
|
if command -v npm > /dev/null; then
|
||||||
npm completion > "$HOME/.local/share/bash-completion/completions/npm.bash"
|
npm completion > "$COMPLETION_DIR/npm.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Poetry
|
### Poetry
|
||||||
if command -v poetry > /dev/null; then
|
if command -v poetry > /dev/null; then
|
||||||
poetry completions bash > "$HOME/.local/share/bash-completion/completions/poetry.bash"
|
poetry completions bash > "$COMPLETION_DIR/poetry.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Volta
|
### Volta
|
||||||
if command -v volta > /dev/null; then
|
if command -v volta > /dev/null; then
|
||||||
volta completions bash > "$HOME/.local/share/bash-completion/completions/volta.bash"
|
volta completions bash > "$COMPLETION_DIR/volta.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### wp-cli (only bash available)
|
### wp-cli (only bash available)
|
||||||
if command -v wp > /dev/null && [ -f /usr/local/src/wp-cli/wp-completion.bash ]; then
|
if command -v wp > /dev/null && [ -f /usr/local/src/wp-cli/wp-completion.bash ]; then
|
||||||
cp /usr/local/src/wp-cli/wp-completion.bash "$HOME/.local/share/bash-completion/completions/wp.bash"
|
cp /usr/local/src/wp-cli/wp-completion.bash "$COMPLETION_DIR/wp.bash"
|
||||||
elif command -v wp > /dev/null; then
|
elif command -v wp > /dev/null; then
|
||||||
curl -sSL https://raw.githubusercontent.com/wp-cli/wp-cli/v2.7.1/utils/wp-completion.bash > "$HOME/.local/share/bash-completion/completions/wp.bash"
|
curl -sSL https://raw.githubusercontent.com/wp-cli/wp-cli/v2.7.1/utils/wp-completion.bash > "$COMPLETION_DIR/wp.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### zoxide
|
### zoxide
|
||||||
if command -v zoxide >/dev/null; then
|
if command -v zoxide >/dev/null; then
|
||||||
zoxide init bash > "$HOME/.local/share/bash-completion/completions/zoxide.bash"
|
zoxide init bash > "$COMPLETION_DIR/zoxide.bash"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue