mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
1ed231cb21
If no argument is passed to the default or local sub commands, report the currently configured version.
55 lines
1.8 KiB
Bash
Executable file
55 lines
1.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
print_set_version() {
|
|
echo "<version> should be a string matching a Ruby version known by rbenv."
|
|
|
|
local versions="$(rbenv-versions --bare)"
|
|
if [ -z "$versions" ]; then
|
|
echo "There are currently no Ruby versions installed for rbenv."
|
|
else
|
|
echo "The currently installed Ruby versions are:"
|
|
echo "$versions" | sed 's/^/ /'
|
|
fi
|
|
|
|
echo
|
|
echo "The special version string 'system' will use your default system Ruby."
|
|
}
|
|
|
|
case "$1" in
|
|
"") echo "usage: rbenv <command> [<args>]
|
|
|
|
Some useful rbenv commands are:
|
|
commands List all commands
|
|
rehash Rehash rbenv shims (run this after installing binaries)
|
|
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
|
|
|
|
See 'rbenv help <command>' for more information on a specific command.
|
|
For more information, see: https://github.com/sstephenson/rbenv#readme"
|
|
;;
|
|
default) echo "usage: rbenv default <version>
|
|
|
|
Sets the default Ruby version. You can override the default at any time
|
|
by setting a directory-specific version with \`rbenv local' or by
|
|
setting the RBENV_VERSION environment variable.
|
|
|
|
$(print_set_version)"
|
|
;;
|
|
local) echo "usage: rbenv local <version>
|
|
|
|
Sets the local directory-specific Ruby version by writing the version
|
|
name to a file named '.rbenv-version'.
|
|
|
|
When you run a Ruby command, rbenv will look for an '.rbenv-version'
|
|
file in the current directory and each parent directory. If no such
|
|
file is found in the tree, rbenv will use the default Ruby version
|
|
specified with \`rbenv default', or the version specified in the
|
|
RBENV_VERSION environment variable.
|
|
|
|
$(print_set_version)"
|
|
;;
|
|
*) echo "No command arguments needed or invalid/undocumented command."
|
|
esac
|