mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Streamline `pyenv-versions --bare'
Achieves a ~20% speedup. As it's used in pyenv-latest, this affects all version lookups
This commit is contained in:
parent
9fe80f28e5
commit
446411dc64
1 changed files with 5 additions and 3 deletions
|
@ -71,8 +71,6 @@ else
|
||||||
current_versions=()
|
current_versions=()
|
||||||
fi
|
fi
|
||||||
if [ -n "$bare" ]; then
|
if [ -n "$bare" ]; then
|
||||||
hit_prefix=""
|
|
||||||
miss_prefix=""
|
|
||||||
include_system=""
|
include_system=""
|
||||||
else
|
else
|
||||||
hit_prefix="* "
|
hit_prefix="* "
|
||||||
|
@ -106,8 +104,12 @@ exists() {
|
||||||
|
|
||||||
print_version() {
|
print_version() {
|
||||||
local version="${1:?}"
|
local version="${1:?}"
|
||||||
|
if [[ -n $bare ]]; then
|
||||||
|
echo "$version"
|
||||||
|
return
|
||||||
|
fi
|
||||||
local path="${2:?}"
|
local path="${2:?}"
|
||||||
if [[ -z "$bare" && -L "$path" ]]; then
|
if [[ -L "$path" ]]; then
|
||||||
# Only resolve the link itself for printing, do not resolve further.
|
# Only resolve the link itself for printing, do not resolve further.
|
||||||
# Doing otherwise would misinform the user of what the link contains.
|
# Doing otherwise would misinform the user of what the link contains.
|
||||||
version_repr="$version --> $(resolve_link "$path")"
|
version_repr="$version --> $(resolve_link "$path")"
|
||||||
|
|
Loading…
Reference in a new issue