You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using direnv with ZSH and I want to add some extra shell-specific initialization to my projects.
My first attempt was to add this to my .zshrc:
# Optional extra init for projects using direnvif [[ -n"$HUBRO_EXTRA_INIT" ]];theneval"$HUBRO_EXTRA_INIT"unset HUBRO_EXTRA_INIT
fi
But since direnv only runs after the shell has initialized, this will never run.
I need to be able to run my own ZSH function any time direnv has finished loading an environment.
How can I do that in ZSH? Are there any official hooks I can use? (I assume no, since I've Googled with no success and had 3 different hallucinations suggested by ChatGPT.)
If not, are there any workarounds / hacks you can suggest?
My main motivation is to be able to source completions for project-specific CLIs, for example eval "$(dev completions zsh)" and set up simple aliases like alias dev="python3 -m my_project.cli"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using direnv with ZSH and I want to add some extra shell-specific initialization to my projects.
My first attempt was to add this to my
.zshrc
:But since direnv only runs after the shell has initialized, this will never run.
I need to be able to run my own ZSH function any time
direnv
has finished loading an environment.How can I do that in ZSH? Are there any official hooks I can use? (I assume no, since I've Googled with no success and had 3 different hallucinations suggested by ChatGPT.)
If not, are there any workarounds / hacks you can suggest?
My main motivation is to be able to source completions for project-specific CLIs, for example
eval "$(dev completions zsh)"
and set up simple aliases likealias dev="python3 -m my_project.cli"
Beta Was this translation helpful? Give feedback.
All reactions