mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-10 07:36:16 -04:00
pyenv-binary: include plugin definitions in build completion
This commit is contained in:
parent
171b318f47
commit
bcdc61bdf8
|
|
@ -21,8 +21,16 @@ set -e
|
|||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
|
||||
# Provide pyenv completions. Only the definitions are useful here: the options
|
||||
# `pyenv install' takes are not accepted.
|
||||
# `pyenv install' takes are not accepted. Include definitions from other
|
||||
# plugins just as `pyenv install' does.
|
||||
if [ "$1" = "--complete" ]; then
|
||||
shopt -s nullglob
|
||||
for plugin_path in "$PYENV_ROOT"/plugins/*/share/python-build; do
|
||||
PYTHON_BUILD_DEFINITIONS="${PYTHON_BUILD_DEFINITIONS}:${plugin_path}"
|
||||
done
|
||||
export PYTHON_BUILD_DEFINITIONS
|
||||
shopt -u nullglob
|
||||
|
||||
echo --archive-url
|
||||
exec python-build --definitions
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -11,11 +11,15 @@ stub_build_environment() {
|
|||
create_stub getconf 'echo "glibc 2.17"'
|
||||
}
|
||||
|
||||
@test "completion lists the option and the buildable versions" {
|
||||
create_stub python-build 'echo 3.12.7'
|
||||
@test "completion lists definitions provided by another plugin" {
|
||||
mkdir -p "${PYENV_ROOT}/plugins/example/share/python-build"
|
||||
touch "${PYENV_ROOT}/plugins/example/share/python-build/3.12.7-example"
|
||||
PATH="${BATS_TEST_DIRNAME}/../../python-build/bin:${PATH}"
|
||||
|
||||
run pyenv-binary-build --complete
|
||||
assert_success "--archive-url
|
||||
3.12.7"
|
||||
assert_success
|
||||
assert_line "--archive-url"
|
||||
assert_line "3.12.7-example"
|
||||
}
|
||||
|
||||
@test "fails with no arguments" {
|
||||
|
|
|
|||
Loading…
Reference in a new issue