dotfiles/.local/share/bash-completion/completions/gi
2024-11-16 15:19:20 +08:00

10 lines
296 B
Plaintext

function _gi() {
cache="/tmp/${FUNCNAME[0]}"
if ! [ -f "$cache" ]; then
curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr ',' '\n' > "$cache"
fi
mapfile -t COMPREPLY < <(compgen -W "$(cat "$cache")" -- "${COMP_WORDS[$COMP_CWORD]}")
}
complete -F _gi gi