Merge pull request #1834 from NoahGorny/lazily-load-pip

completion: pip: Only invoke pip when trying to complete it
pull/1960/head
Noah Gorny 2021-09-20 14:47:41 +03:00 committed by GitHub
commit 4984d7adc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -7,5 +7,13 @@
# you should first initialize the corresponding environment.
# So that pip is in the system's path.
if _command_exists pip; then
function __bash_it_complete_pip() {
if _command_exists _pip_completion; then
_pip_completion "$@"
else
eval "$(pip completion --bash)"
_pip_completion "$@"
fi
}
complete -o default -F __bash_it_complete_pip pip
fi

View File

@ -7,5 +7,13 @@
# you should first initialize the corresponding environment.
# So that pip3 is in the system's path.
if _command_exists pip3; then
function __bash_it_complete_pip3() {
if _command_exists _pip_completion; then
_pip_completion "$@"
else
eval "$(pip3 completion --bash)"
_pip_completion "$@"
fi
}
complete -o default -F __bash_it_complete_pip3 pip3
fi