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

Update direnv example to run in pre_prompt rather than env_change #276

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

johnae
Copy link
Contributor

@johnae johnae commented Aug 16, 2022

Any updates to the env should be applied automatically without having to step out/in to the directory again.

Any updates to the env should be applied automatically without having to step out/in to the directory again.
@fdncred
Copy link
Collaborator

fdncred commented Aug 16, 2022

This change will make direnv run before every prompt in every directory, even if you stay in the same directory and just hit enter over and over again. Is that the intent? It seems like there should at least be a check to see if any of the direnv files exist or if the envs are set, but maybe direnv already does that?

@johnae
Copy link
Contributor Author

johnae commented Aug 16, 2022

@fdncred Yeah that's the intent. @zimbatm could perhaps comment on the efficiency of doing this but AFAIK it is how it's done in other shells.

@fdncred
Copy link
Collaborator

fdncred commented Aug 16, 2022

@johnae ok, i don't have a problem landing your change but can you please explain why the PWD hook is not working? We may have a bug there.

@johnae
Copy link
Contributor Author

johnae commented Aug 16, 2022

@fdncred - it's working. It's just that if you change the environment but never leave the directory, direnv won't run and you won't see your changes. I think, therefore, it's more appropriate to run pre_prompt as that results in the expected behavior. I think I was mistaken basically in using env_change when I originally submitted these examples.

@johnae
Copy link
Contributor Author

johnae commented Aug 16, 2022

What I mean is, if you do change the source of the direnv environment, you want those changes to be reflected without having to step out/in to the directory again (eg. PWD changes). Running pre_prompt solves this.

@fdncred fdncred merged commit 94d2b58 into nushell:main Aug 16, 2022
@fdncred
Copy link
Collaborator

fdncred commented Aug 16, 2022

understood. thanks for the explanation.

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.

2 participants