Shell Integration
Klim provides two shell integration features: completions for tab completion and hooks for automatic .klim.yaml checking whenever you enter a project.
Tab Completion
Section titled “Tab Completion”Generate native tab completions for all klim commands, flags, and arguments.
# Current sessionsource <(klim shell completion bash)
# Persistent — add to ~/.bashrcecho 'source <(klim shell completion bash)' >> ~/.bashrc# Current sessionsource <(klim shell completion zsh)
# Persistent — add to ~/.zshrcecho 'source <(klim shell completion zsh)' >> ~/.zshrc# Current sessionklim shell completion fish | source
# Persistentklim shell completion fish > ~/.config/fish/completions/klim.fish# Current sessionklim shell completion powershell | Out-String | Invoke-Expression
# Persistent — add to $PROFILEAdd-Content $PROFILE 'klim shell completion powershell | Out-String | Invoke-Expression'Shell Hook
Section titled “Shell Hook”The shell hook automatically checks .klim.yaml requirements when you cd into a project directory — like nvm or direnv for your toolchain.
How It Works
Section titled “How It Works”- You
cdinto a directory - The hook walks up the directory tree looking for
.klim.yaml - If found, it runs
klim checksilently - Only prints output when tools are missing or outdated
eval "$(klim shell hook bash)"
# Persistent — add to ~/.bashrcecho 'eval "$(klim shell hook bash)"' >> ~/.bashrceval "$(klim shell hook zsh)"
# Persistent — add to ~/.zshrcecho 'eval "$(klim shell hook zsh)"' >> ~/.zshrcklim shell hook fish | source
# Persistentklim shell hook fish > ~/.config/fish/conf.d/klim-hook.fishklim shell hook powershell | Out-String | Invoke-Expression
# Persistent — add to $PROFILEAdd-Content $PROFILE 'klim shell hook powershell | Out-String | Invoke-Expression'Example
Section titled “Example”When you cd into a project with missing or outdated tools:
$ cd my-k8s-project ✗ kubectl — (>=1.28) ⚠ terraform 1.5.0 (>=1.7) Run 'klim check' for details or 'klim import' to install missing tools.Both Together
Section titled “Both Together”For the best experience, set up both completion and hook:
# bashecho 'source <(klim shell completion bash)' >> ~/.bashrcecho 'eval "$(klim shell hook bash)"' >> ~/.bashrc