Created
August 28, 2023 15:41
-
-
Save wess/197c2719265321c67dee2835c8ae97b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc or ~/.zshrc | |
# Direnv setup | |
eval "$(direnv hook bash)" # or 'zsh' if you're using zsh | |
# Asdf setup (assuming you've set up asdf as per its documentation) | |
. $HOME/.asdf/asdf.sh | |
# Custom 'use' command for direnv | |
use_asdf() { | |
local tool_version | |
for tool_version in $(cat .tool-versions); do | |
local tool_name | |
tool_name=$(echo $tool_version | awk '{print $1}') | |
local version | |
version=$(echo $tool_version | awk '{print $2}') | |
asdf local $tool_name $version | |
done | |
} | |
# If the `.envrc` file has 'use asdf', it will run the above function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment