pkgx icon indicating copy to clipboard operation
pkgx copied to clipboard

magic: support `/.env(rc)?/` files

Open mxcl opened this issue 2 years ago • 4 comments

if we find .env or .envrc files then load them.

support it the same as https://direnv.net does.

/cc @jhheider, @jonchang, @mfts for opinion

mxcl avatar Dec 01 '22 19:12 mxcl

My biggest annoyance with direnv is that it wants export statements, so a "normal" env doesn't work out of the box. But matching ^/(export )?[:alnum:]+=.*$/ should be easy enough.

jhheider avatar Dec 01 '22 19:12 jhheider

It sounds good! I admit that I've never used any of the autoenv stuff (and in fact have tea's zsh magic turned off), but it would be good to document e.g. in what order tea searches for the appropriate env files and possibly have a command when within the env that shows how the current environment was determined.

jonchang avatar Dec 01 '22 19:12 jonchang

yeah I agree docs will be important, already we have a hierarchy of files that we don't document (README/package.json/VERSION, more in fact)

mxcl avatar Dec 02 '22 20:12 mxcl

and in fact have tea's zsh magic turned off

fortunately getting the env without this is as easy as typing tea before everything. Though tea/cmd will make it so you can have a brew like install for everything. Certainly don't want anyone to feel they must use tea.env it's more a “this is a neat feature we will try to convince you to use over time—provided it is actually neat” thing.

In general our attitude is: here's a bunch of neat ways to do things, hopefully some of them fit into your workflows.

mxcl avatar Dec 02 '22 20:12 mxcl

This is partly done by 0.23. I elected to only parse out the export lines. I think we should pkg direnv for users who want the full functionality.

mxcl avatar Feb 11 '23 18:02 mxcl