Skip to content

Shell Integration

Klim provides two shell integration features: completions for tab completion and hooks for automatic .klim.yaml checking whenever you enter a project.

Generate native tab completions for all klim commands, flags, and arguments.

Terminal window
# Current session
source <(klim shell completion bash)
# Persistent — add to ~/.bashrc
echo 'source <(klim shell completion bash)' >> ~/.bashrc

The shell hook automatically checks .klim.yaml requirements when you cd into a project directory — like nvm or direnv for your toolchain.

  1. You cd into a directory
  2. The hook walks up the directory tree looking for .klim.yaml
  3. If found, it runs klim check silently
  4. Only prints output when tools are missing or outdated
Terminal window
eval "$(klim shell hook bash)"
# Persistent — add to ~/.bashrc
echo 'eval "$(klim shell hook bash)"' >> ~/.bashrc

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.

For the best experience, set up both completion and hook:

Terminal window
# bash
echo 'source <(klim shell completion bash)' >> ~/.bashrc
echo 'eval "$(klim shell hook bash)"' >> ~/.bashrc