That’s it! That’s the entire rbenv file.
In the process of learning about this command, we talked about:
- What annotations are.
- How to read RBENV’s tests.
- Testing happy paths, sad paths, and alternate paths.
- What command substitution is.
- What “red-green-refactor” and “test-driven development” mean.
- How to use the
shiftcommand. - How to use
xtraceplus thePS4env var to debug your code - The
BASH_SOURCE,LINENO, andFUNCNAMEenvironment variables which ship with bash. - More ways to use parameter expansion, such as the
:+modifier. - How to define a shell function.
- How to group multiple lines of output together, using the
{ ... }curly brace syntax. - What data streams (ex.-
stdout,stdin, andstderr) are - How to redirect output from one data stream to another.
- What ‘piping’ is, and how it differs from ‘redirection’.
- How to count the parameters passed to a file or function, using the
"$#"syntax. - How to read from standard input using the
cat -command. - What the
.dylibfile extension means. - Dynamically loading helper libraries and overriding builtin commands, using
enable -f. - What
/dev/nullis and how to use it. - Using the
localkeyword inside a function to limit a variable’s scope. - Combining command substitution with the
echocommand, to return arbitrary data from a function. - What native extensions are.
- Resolving a file’s canonical filepath using the
readlinkcommand. - Performing a path search on a command using the
typecommand. - Displaying the first N lines of a stream of input using the
headcommand. - What hard links and symbolic links are, and how they work.
- Preventing an error from causing an early exit of the script, using the
|| truepattern. - Iterating over paths in a directory more safely, using the
shopt -s nullglobcommand. - What the Filesystem Hierarchy Standard (or FHS) is.
- How to read a version number.
- Finding the true path to a command, bypassing any aliases or shell functions, using the
commandcommand. - Calling child scripts which
exportenvironment variables that are usable by the parent script, using theecho+evalpattern.
What should we do next?
Normally I’d want to copy the order in which the files appear in the “libexec” directory, which would mean looking at rbenv---version next. But I still have questions around shell integration and the rbenv-init file, mainly:
- Why would someone not want to enable shell integration?
- What’s the downside of enabling it?
- How would you use RBENV without it?
I think it makes more sense to start with rbenv-init and come back to rbenv---version afterward.