Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env._.run #1448

Closed
jdx opened this issue Jan 13, 2024 · 9 comments · Fixed by #3256
Closed

env._.run #1448

jdx opened this issue Jan 13, 2024 · 9 comments · Fixed by #3256

Comments

@jdx
Copy link
Owner

jdx commented Jan 13, 2024

similar to #1447, it should be possible to execute arbitrary scripts which "export" env vars like this:

[env]
_.run = "./myscript"

Where unlike in #1447, this would be run like any other binary. Somehow it needs to pull env vars out of it, I know that direnv has a trick where they launch direnv inside of this script and that is able to pull the env vars out. We'll need something like that to make this possible.

@malteo
Copy link

malteo commented Feb 13, 2024

could the arbitrary script execute anything? I would like, for example, to automatically docker compose up when I enter some projects' dir

this could replace (my use of) direnv

@zshannon
Copy link

Would love to use this to load env vars from 1Password

@laluka
Copy link

laluka commented Mar 31, 2024

Would be lovely for scripts execution, but for single commands as well, to have atomic commands too 🙏

@Ernest0-Production
Copy link

Are there any plans to do this?

@jdx
Copy link
Owner Author

jdx commented May 6, 2024

You're welcome to take it on

@sandstrom
Copy link

@jdx If you are open to it, we'd be willing to sponsor some improvements around this issue as well as these other two:

Of course, this assumes you are onboard with the proposed changes.

In short, we are trying to replace direnv with Mise and there are some differences in how they work, which are currently blocking a switch. Happy to elaborate on the details if you want to know more about what's keeping us from switching.

I'd guess you are probably busy, but just wanted to ask 😄

@jdx jdx mentioned this issue Nov 29, 2024
@jdx jdx closed this as completed in #3256 Nov 29, 2024
@sandstrom
Copy link

sandstrom commented Nov 29, 2024

@jdx Awesome 😄

If you enable donations and ping me we'll still send something over (we're not a huge company though, just a dozen of engineers).

In either case, this is great and I think (a colleague is double-checking) that this will unblock us from moving off direnv to Mise! 🎉

@jdx
Copy link
Owner Author

jdx commented Nov 29, 2024

I really appreciate that! let me know how it works, it was quite a bit of code and it's a bit tricky to test but I had it working well enough on my machine. I added sponsorship to my GH profile.

@sandstrom
Copy link

@jdx Great!

I'm not directly involved but my colleague will likely write back here or in the other issue that was also closed yesterday (those were related) in case there are questions.

You should see some fresh sponsorship. I know it's not much, but at least it's something (we're not a big company).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants