11 lines
393 B
Plaintext
11 lines
393 B
Plaintext
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
|