bash-it and ohmyzsh are two popular frameworks for extending the functionality of Bash and ZSH, respectively. One of their features is a built-in themeing system, and both implementations already try to integrate with some (but not all) Ruby version switchers to display the currently active Ruby as part of the shell prompt. At least in bash-it's case, this integration appears to have started out supporting RVM only, with support for rbenv and rbfu added later. This results in unfortunate code like this example.
We've recently agreed to use
.ruby-version instead of switcher-specific files (
.rbenv-version etc.), maybe we can also find a simple common name for an environment variable containing the currently selected Ruby (including patchlevel)?
Right now, the two alternatives I'm seeing are:
- Implementing switcher-specific code (what people have been doing so far)
- Grep the version from
ruby -v(which would work, but may be a bit overkill to do)
- ...maybe there are more?
Thanks for your time and input.