Install shell completions

Tab completion for bash, zsh, fish, PowerShell and elvish.

Written By Dustin

Last updated 28 minutes ago

TOVIO generates its own completion scripts from the live command surface. The subcommand takes exactly one argument, the shell:

tovio completions bashtovio completions zshtovio completions fishtovio completions powershelltovio completions elvish

Those five are the whole accepted set; anything else is rejected with the list of valid values. Each prints the script to standard output and writes nothing itself, so you choose where it goes. It does not need a repository — you can generate completions before you have created one.

bash

tovio completions bash > ~/.local/share/bash-completion/completions/tovio

zsh

Write it as _tovio into a directory on your fpath, then start a new shell:

tovio completions zsh > ~/.zfunc/_tovio

If ~/.zfunc is not already on your fpath, add fpath=(~/.zfunc $fpath) before compinit runs in your .zshrc.

fish

tovio completions fish > ~/.config/fish/completions/tovio.fish

PowerShell

Append the output to your profile so it loads in every session:

tovio completions powershell | Out-File -Append -Encoding utf8 $PROFILE

elvish

Source the generated script from rc.elv.

Regenerate after upgrading

The script is a snapshot of the command surface at the version that generated it — several thousand lines of it. After an upgrade that adds or renames a command or a flag, regenerate rather than wondering why a new flag will not complete. If completion silently stops suggesting anything, a stale script from a much older binary is the usual cause.