mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-17 15:53:45 -05:00
Report default or local version.
If no argument is passed to the default or local sub commands, report the currently configured version.
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
#!/usr/bin/env bash -e
|
||||
|
||||
RBENV_VERSION="$1"
|
||||
VERSION_FILE="${HOME}/.rbenv/default"
|
||||
if [ -z "$RBENV_VERSION" ]; then
|
||||
echo "usage: rbenv default VERSION" >&2
|
||||
exit 1
|
||||
if [[ -e "$VERSION_FILE" ]]; then
|
||||
cat "$VERSION_FILE"
|
||||
else
|
||||
echo "No default version configured - set with: rbenv default <version>"
|
||||
fi
|
||||
else
|
||||
# Make sure the specified version is installed
|
||||
rbenv-prefix "$RBENV_VERSION" >/dev/null
|
||||
|
||||
echo "$RBENV_VERSION" > "$VERSION_FILE"
|
||||
fi
|
||||
|
||||
# Make sure the specified version is installed
|
||||
rbenv-prefix "$RBENV_VERSION" >/dev/null
|
||||
|
||||
echo "$RBENV_VERSION" > "${HOME}/.rbenv/default"
|
||||
|
||||
@@ -22,8 +22,8 @@ case "$1" in
|
||||
Some useful rbenv commands are:
|
||||
commands List all commands
|
||||
rehash Rehash rbenv shims (run this after installing binaries)
|
||||
default Set the default Ruby version
|
||||
local Set a local directory-specific Ruby version
|
||||
default Set or show the default Ruby version
|
||||
local Set or show the local directory-specific Ruby version
|
||||
version Show the current Ruby version
|
||||
versions List all Ruby versions known by rbenv
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
#!/usr/bin/env bash -e
|
||||
|
||||
RBENV_VERSION="$1"
|
||||
VERSION_FILE=".rbenv-version"
|
||||
if [ -z "$RBENV_VERSION" ]; then
|
||||
echo "usage: rbenv local VERSION" >&2
|
||||
exit 1
|
||||
if [[ -e "$VERSION_FILE" ]]; then
|
||||
cat "$VERSION_FILE"
|
||||
else
|
||||
echo "No local version configured - set with: rbenv local <version>"
|
||||
fi
|
||||
else
|
||||
# Make sure the specified version is installed
|
||||
rbenv-prefix "$RBENV_VERSION" >/dev/null
|
||||
|
||||
echo "$RBENV_VERSION" > "$VERSION_FILE"
|
||||
fi
|
||||
|
||||
# Make sure the specified version is installed
|
||||
rbenv-prefix "$RBENV_VERSION" >/dev/null
|
||||
|
||||
echo "$RBENV_VERSION" > .rbenv-version
|
||||
|
||||
Reference in New Issue
Block a user