Conversation
|
Just guessing here but it seems that one reason to run a hook in pre-prompt is to allow something from the direnv to update the prompt. Maybe you can do that too in the env_change hook. Not sure. |
not sure 🤔 one thing we could do is define a constant in that script that one could source and add to either the env_change or the pre_prompt? |
fdncred
left a comment
There was a problem hiding this comment.
Seems like it explain two ways to do it, so it looks better to me. I don't use direnv so I can't test it.
|
@fdncred $env.config.hooks.env_change.PWD = []
$env.config.hooks.env_change.PWD = (
$env.config.hooks.env_change.PWD | append (source ~/documents/repos/github.com/amtoine/nu_scripts/hooks/direnv/config.nu)
)went into a directory with a |
i wanted to install and run
direnvwith Nushell, came accross this hook and thought i could update it a bit 😋changelog
config.nupossible tosource=> it will add the hook to the list of hooks, without overwriting$env.config.hooks.env_change.PWDinstead of$env.config.hooks.pre_prompt=> i think this is the most controversial change, we can discuss that of coursedirenvis in thePATHbefore running the rest of the hookdefaultto load the environmenti tested this before and after and i think this works just as before 😌