Files
bash-it/completion/available/pip3.completion.bash
John D Pell b897c7d3ce completion/pip: simplify code flow
Short-circuit the loader rather than indenting nearly the whole file.

ALSÖ, assign the `_pip_completion()` handler directly once it's loaded so that we get out of the way once we load it.
2021-09-23 22:21:02 -07:00

21 lines
677 B
Bash

# shellcheck shell=bash
# https://pip.pypa.io/en/stable/user_guide/#command-completion
# Of course, you should first install pip, say on Debian:
# sudo apt-get install python3-pip
# If the pip package is installed within virtual environments, say, python managed by pyenv,
# you should first initialize the corresponding environment.
# So that pip3 is in the system's path.
_command_exists pip3 || return
function __bash_it_complete_pip3() {
if _command_exists _pip_completion; then
complete -o default -F _pip_completion pip3
_pip_completion "$@"
else
eval "$(pip3 completion --bash)"
_pip_completion "$@"
fi
}
complete -o default -F __bash_it_complete_pip3 pip3