Skip to content

klim shell hook

Generate a shell hook that automatically runs klim check when you cd into a directory with a .klim.yaml file — like nvm or direnv for your toolchain.

Terminal window
klim shell hook <bash|zsh|fish|powershell>
  1. You add the hook to your shell startup file
  2. Every time you cd into a directory, the hook walks up the directory tree
  3. If it finds a .klim.yaml, it runs klim check silently
  4. Only prints output when tools are missing or outdated
Terminal window
# bash — add to ~/.bashrc
eval "$(klim shell hook bash)"
# zsh — add to ~/.zshrc
eval "$(klim shell hook zsh)"
# fish — save to conf.d
klim shell hook fish > ~/.config/fish/conf.d/klim-hook.fish
# powershell — add to $PROFILE
klim shell hook powershell | Out-String | Invoke-Expression

When you cd into a project with missing tools:

✗ kubectl — (>=1.28)
⚠ terraform 1.5.0 (>=1.7)
Run 'klim check' for details or 'klim import' to install missing tools.