dotfiles/.config/bash/completion.bash

31 lines
757 B
Bash

shopt -s progcomp_alias
complete -r -D
for f in kill kubectl git pacman ssh xrandr; do
# shellcheck disable=SC1090
. "/usr/share/bash-completion/completions/$f"
done
complete -F _pacman pac
function _kns() {
mapfile -t COMPREPLY < <(compgen -W \
"$(kubectl get namespace -o jsonpath='{..metadata.name}')" \
-- "${COMP_WORDS[1]}")
}
complete -F _kns kns
function _kctx() {
mapfile -t COMPREPLY < <(compgen -W \
"$(kubectl config get-contexts -o name)" \
-- "${COMP_WORDS[1]}")
}
complete -F _kctx kctx
function _gi() {
mapfile -t COMPREPLY < <(compgen -W \
"$(curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr ',' '\n')" \
-- "${COMP_WORDS[1]}")
}
complete -F _gi gi