.dotfiles/.local/share/bash-completion/completions/ddev
2025-01-30 13:55:36 +00:00

13 lines
409 B
Bash

# vim: ft=bash
function _ddev() {
cache="/tmp/${FUNCNAME[0]}"
if ! [ -f "$cache" ]; then
curl -sfL 'https://api.github.com/repos/docker-library/official-images/git/trees/master?recursive=1' | sed -nE 's/.*"library\/(.+)",$/\1/p' > "$cache"
fi
[ "$COMP_CWORD" -ne 1 ] && return
mapfile -t COMPREPLY < <(compgen -W "$(cat "$cache")" -- "${COMP_WORDS[1]}")
}
complete -F _ddev ddev