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

add "nuenv" hook #889

Merged
merged 5 commits into from
Jul 3, 2024
Merged

add "nuenv" hook #889

merged 5 commits into from
Jul 3, 2024

Conversation

amtoine
Copy link
Member

@amtoine amtoine commented Jun 29, 2024

💡 Note

greatly inspired by Direnv

this new "nuenv" hook will source any .env.nu file found in the current directory as part of a hook.

in order to be a bit more safe, i've added nuenv allow and nuenv disallow that will keep track of which "env" files are allowed to be sourced, i.e. if a file is not allowed, then you'll have to run nuenv allow first.

example usage

use nu-hooks/nuenv/hook.nu [ "nuenv allow", "nuenv disallow" ]
$env.config.hooks.env_change.PWD = (use nu-hooks/nuenv/hook.nu; hook setup)

amtoine added a commit to amtoine/dotfiles that referenced this pull request Jun 29, 2024
@amtoine
Copy link
Member Author

amtoine commented Jul 3, 2024

this is pretty simple and kinda the same as #888, so i'll just merge it and we can definitely improve it in the future 🙏

@amtoine amtoine merged commit d6cf03e into nushell:main Jul 3, 2024
1 check passed
@amtoine amtoine deleted the nuenv-hook branch July 3, 2024 20:06
fdncred pushed a commit that referenced this pull request Jul 21, 2024
as per title

## changelog
- "did you mean" improved in #811
- "nuenv" added in #889
- "startup times" added in #888
- "tookit" added in #888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant