Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Last active December 6, 2024 13:37
Show Gist options
  • Save coderofsalvation/141e9ef881357525101b38ac7f5bc68f to your computer and use it in GitHub Desktop.
Save coderofsalvation/141e9ef881357525101b38ac7f5bc68f to your computer and use it in GitHub Desktop.
autoenv/direnv in one shell function
# minimalist version of https://github.com/hyperupcall/autoenv
cd(){
test -f .env.leave && source .env.leave # cleanup environment
builtin cd ${1:+"$@"} && {
test -f .env && source .env # setup environment / run scripts e.g.
test -d .git && git remote -v # react to implicit metadata
ls # list directories
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment