* perf: replace a series of if statements with a case block. Add error
handling for case where unknown option is provided.
Same setup as rbenv-init for reading arguments.
* perf, docs: Recommend users to specify the shell for `pyenv init -`
Speeds up the startup by about 40% (in local testing, from ~50ms to ~30ms).
Reflect this in `pyenv init` hint text.
* style: remove unnecessary `root` variable in pyenv-init
* style: remove unnecessary variable declarations at the top of file in pyenv-init.
* perf: replace `cat <<` calls with `echo`
The builtin `echo` is about 100x faster. In tests, saves about 2-3ms.
* docs: document the `pyenv init - <shell>` performance boost in the Advanced Configuration section.
* style: test_helper.bash: avoid unnecessary ".." in produced PATH
* docs: fix a false statement about completions location in the Advanced Configuration section.
Requested in https://github.com/pyenv/pyenv/issues/2680
for deployments with a stock `.pyenv-version` that can use any
of a number of Python versions
and for compatibility with `uv`.
* Support `pyenv local --force`
* Support `pyenv-version-file-write --force`
* Support `pyenv version-name --force`
* Ignore missing versions when searching for executables
* Display "commmand not found" even when there are nonexistent versions
* exec.bats: replace `python` and `rspec` with something that doesn't exist globally, either
in Ubuntu Github CI, `python` exists globally
Since 3.13, CPython is provided in 2 flavors: regular and
free-threaded, with the 't' suffix.
An incomplete prefix ending with '[0-9]t'
resolves only among versions that also end with '[0-9]t'
Fixes use of version specifiers like `python-3.12`, which:
- have an explicit `python-` prefix
- are using a major version alias that has to be resolved
to an exact version.
Also simplified the conditional for the already
working case, since it had two branches that were virtually identical.
The directory /usr/etc is an optional directory and used by
Fedora, RHEL 9, and openSUSE. The purpose of /usr/etc is to store
distribution-provided configuration files that can be overridden
by user-modified files in /etc.
/usr/etc is not in FHS. However, as Torsten stated in his comment
(https://github.com/thkukuk/atomic-updates_and_etc/issues/2#issuecomment-524848666)
"[FHS] is currently nearly as dead as LSB, we can only ignore it
if we don't want to stop and kill all innovation."
In exceptional cases (custom installation, malfunctions elsewhere), `pyenv-commands --sh` may return nothing.
In non-Fish, this would cause "syntax error near unexpected token `)'" in `pyenv()`.
Bash does not allow to specify a `case` option that would never match.
This works around it by defaulting to `/`. Commands, being filenames, can never match it.
In Fish, nothing needs to be done: it apparently does interpret a `case` without argument as one that never matches.