From: Oleg Broytman Date: Sun, 14 Jul 2024 21:49:53 +0000 (+0300) Subject: .bash_completion.d: Update `python-pip` completion X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=535c3fe0d8c2d534386eadce992b4e36b570867f;p=dotfiles.git .bash_completion.d: Update `python-pip` completion --- diff --git a/.bash_completion.d/python-pip b/.bash_completion.d/python-pip index f6e3126..3f5482f 100644 --- a/.bash_completion.d/python-pip +++ b/.bash_completion.d/python-pip @@ -1,14 +1,15 @@ -PY_VERSIONS="2,2.7,3," +PY_VERSIONS=",2,2.7,3," PY_VERSIONS+="$(eval echo 3.{`seq -s, 4 12`} | sed 's/ /,/g')" -eval delegate_completion python python{$PY_VERSIONS} +eval delegate_completion python{$PY_VERSIONS} _pip_completion_loader() { if [ "`type -t _pip_completion`" != function ]; then - eval "`pip3 completion --bash`" + for pip in `eval type -fP pip{3,2,}`; do break; done + eval "`$pip completion --bash`" fi - eval complete -F _pip_completion pip pip{$PY_VERSIONS} + eval complete -F _pip_completion pip{$PY_VERSIONS} unset _pip_completion_loader PY_VERSIONS return 124 } -eval complete -F _pip_completion_loader pip pip{$PY_VERSIONS} +eval complete -F _pip_completion_loader pip{$PY_VERSIONS}