Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove zsh pypi completion #3348

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions src/pdm/cli/completions/pdm.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#compdef pdm

PDM_PYTHON="%{python_executable}"
PDM_PYPI_URL=$(PDM_CHECK_UPDATE=0 "${PDM_PYTHON}" -m pdm config pypi.url)

_pdm() {
emulate -L zsh -o extended_glob
Expand Down Expand Up @@ -92,7 +91,6 @@ _pdm() {
{-C,--config-setting}'[Pass options to the backend. options with a value must be specified after "=": "--config-setting=key(=value)" or "-Ckey(=value)"]:cs:'
"--no-isolation[do not isolate the build in a clean environment]"
"--dry-run[Show the difference only without modifying the lockfile content]"
'*:packages:_pdm_pip_packages'
)
;;
build)
Expand Down Expand Up @@ -307,14 +305,12 @@ _pdm() {
add)
arguments+=(
'--pip-args[Arguments that will be passed to pip install]:pip args:'
'*:packages:_pdm_pip_packages'
)
;;
remove)
arguments+=(
'--pip-args[Arguments that will be passed to pip uninstall]:pip args:'
{-y,--yes}'[Answer yes on the question]'
'*:packages:_pdm_pip_packages'
)
;;
list)
Expand Down Expand Up @@ -672,35 +668,4 @@ _pdm_lock_platform() {
_describe -t platform "platform" platforms
}

_pdm_caching_policy() {
[[ ! -f $1 && -n "$1"(Nm+28) ]]
}

_pdm_pip_packages_update() {
typeset -g _pdm_packages
if _cache_invalid pdm_packages || ! _retrieve_cache pdm_packages; then
local index
_pdm_packages+=($(command curl -sL $PDM_PYPI_URL | command sed -nE '/<a href/ s/.*>(.+)<.*/\1/p'))
_store_cache pdm_packages _pdm_packages
fi
}

_pdm_pip_packages() {
if (( ! $+commands[curl] || ! $+commands[sed] )); then
_message "package name"
return 1
fi

local update_policy
zstyle ":completion:${curcontext%:}:" use-cache on
zstyle -s ":completion:${curcontext%:}:" cache-policy update_policy
if [[ -z $update_policy ]]; then
zstyle ":completion:${curcontext%:}:" cache-policy _pdm_caching_policy
fi

local -a _pdm_packages
_pdm_pip_packages_update
compadd -X packages -a _pdm_packages
}

_pdm "$@"
Loading