feat: optimized ddev completion
This commit is contained in:
parent
87d37712dd
commit
36e07e4988
@ -1,14 +1,6 @@
|
||||
function _ddev() {
|
||||
# limited to 100 images
|
||||
for i in {1..5}; do
|
||||
URL="https://hub.docker.com/v2/repositories/library/?page=$i&page_size=100"
|
||||
mapfile -t res < <(compgen -W \
|
||||
"$(curl -sfL "$URL" | jq -r '.results[].name')" \
|
||||
mapfile -t COMPREPLY < <(compgen -W \
|
||||
"$(curl -sfL 'https://api.github.com/repos/docker-library/official-images/git/trees/master?recursive=1' | sed -nE 's/.*"library\/(.+)",$/\1/p')" \
|
||||
-- "${COMP_WORDS[1]}")
|
||||
if [ -z "${res[0]}" ]; then
|
||||
break
|
||||
fi
|
||||
COMPREPLY+=("${res[@]}")
|
||||
done
|
||||
}
|
||||
complete -F _ddev ddev
|
||||
|
Loading…
Reference in New Issue
Block a user