-delegate_completion python python2.7 python3.4 python3.5 python3.6 python3.7 python3.8 python3.9 python3.10 python3.11 python3.12
+PY_VERSIONS="2,2.7,3,"
+PY_VERSIONS+="$(eval echo 3.{`seq -s, 4 12`} | sed 's/ /,/g')"
-if type -p pip >/dev/null 2>&1; then
- _PIP=pip
-elif type -p pip3 >/dev/null 2>&1; then
- _PIP=pip3
-fi
+eval delegate_completion python python{$PY_VERSIONS}
-if [ -n "$_PIP" ]; then
- _pip_completion_loader() {
- eval "`$_PIP completion --bash`"
- complete -F _pip_completion pip pip2 pip2.7 pip3 pip3.4 pip3.5 pip3.6 pip3.7 pip3.8 pip3.9 pip3.10 pip3.11 pip3.12
- unset _pip_completion_loader
- return 124
- }
- complete -F _pip_completion_loader pip pip2 pip2.7 pip3 pip3.4 pip3.5 pip3.6 pip3.7 pip3.8 pip3.9 pip3.10 pip3.11 pip3.12
-fi
+_pip_completion_loader() {
+ if [ "`type -t _pip_completion`" != function ]; then
+ eval "`pip3 completion --bash`"
+ fi
+ eval complete -F _pip_completion pip pip{$PY_VERSIONS}
+ unset _pip_completion_loader PY_VERSIONS
+ return 124
+}
+eval complete -F _pip_completion_loader pip pip{$PY_VERSIONS}