News for hackers. Stuff that matters.
Re:Moreutils – Unix tools that nobody thought to write (2012) by breuleux on Sunday August 23, 2020 @11:36AM (#24252605)
direnv does allow more than just environment variables, you can run arbitrary commands. Personally I wouldn't run potentially expensive commands like building the project, but if that's really what's best for your workflow, it can be done.

If there is no .envrc in the directory it will look for one in the parent directory, but it won't activate more than one.

Also one thing it does that your hand-rolled version does not is that it remembers what the environment variables were before and restores them to that state when you exit the directory.

Re:Moreutils – Unix tools that nobody thought to write (2012) by flukus on Sunday August 23, 2020 @09:41PM (#24256854)
> Personally I wouldn't run potentially expensive commands like building the project

My above example wasn't running the command, just defining it to be run manually. The .env becomes a dumping ground for all sorts of project specific stuff. The docs say direnv doesn't support this.

> Also one thing it does that your hand-rolled version does not is that it remembers what the environment variables were before and restores them to that state when you exit the directory.

I've thought of adding this, but apart from a couple of things I reset manually I haven't really found the need.

Re:Moreutils – Unix tools that nobody thought to write (2012) by breuleux on Monday August 24, 2020 @07:09PM (#24266535)
Ohh, okay, I see.

You're right, you can't define aliases/functions using direnv. That's a shame, that does seem useful.