mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-14 06:13:53 -05:00
search commands from python version stack.
users can use multiple python versions at once.
This commit is contained in:
@@ -7,16 +7,20 @@ VERSION_FILE="$1"
|
||||
if [ -e "$VERSION_FILE" ]; then
|
||||
# Read and print the first non-whitespace word from the specified
|
||||
# version file.
|
||||
version=""
|
||||
versions=()
|
||||
while read -a words; do
|
||||
word="${words[0]}"
|
||||
if [ -z "$version" ] && [ -n "$word" ]; then
|
||||
version="$word"
|
||||
if [ -n "$word" ]; then
|
||||
length="${#versions[@]}"
|
||||
versions=("${versions[@]}" "$word")
|
||||
fi
|
||||
done < <( cat "$VERSION_FILE" && echo )
|
||||
|
||||
if [ -n "$version" ]; then
|
||||
echo "$version"
|
||||
if [ -n "$versions" ]; then
|
||||
{
|
||||
IFS=:
|
||||
echo "${versions[*]}"
|
||||
}
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user