Skip to content

Shell completion

The varlock CLI supports tab completion for subcommands and flags. Setup is a one-time step per shell.

Generate a completion script with varlock complete <shell>, then install it using the instructions below for your shell.

After upgrading varlock, re-run varlock complete <shell> if new commands or flags were added.

Zsh completion files must be named with a leading underscore:

Terminal window
mkdir -p ~/.zsh/completions
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -U compinit && compinit' >> ~/.zshrc
varlock complete zsh > ~/.zsh/completions/_varlock
source ~/.zshrc

Tab completion covers varlock subcommands and static flags (including enum choices like load --format).

Dynamic values — such as env var names from your schema — are not completed yet.

If completions stop working after an upgrade, regenerate the script:

Terminal window
npm exec -- varlock complete zsh > ~/.zsh/completions/_varlock

Replace zsh and the output path with your shell and install location.