grithdocs

grith completions

Print a shell completion script to stdout. Works even when your config is broken.

grith completions <SHELL>

Writes a completion script for bash, zsh, fish, elvish or powershell to stdout. Nothing is installed for you - redirect it where your shell expects it.

terminal
$ grith completions bash | head -4
_grith() {
  local i cur prev opts cmd
  COMPREPLY=()
  if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then

Installing it

# bash
grith completions bash > ~/.local/share/bash-completion/completions/grith

# zsh - anywhere on your fpath
grith completions zsh > "${fpath[1]}/_grith"

# fish
grith completions fish > ~/.config/fish/completions/grith.fish

Regenerate after upgrading grith - the script is a snapshot of the command tree at the moment you ran it.

ℹ️It runs before anything else

completions is handled before the config is loaded and before logging is initialised, so it still works when config.toml is broken. That makes it a useful way to confirm the binary itself is fine.

An unsupported shell is a usage error, exit 2:

terminal
$ grith completions foo
error: invalid value 'foo' for '<SHELL>'
[possible values: bash, elvish, fish, powershell, zsh]

For more information, try '--help'.

See also

Last updated: 2026-08-24Edit this page on GitHub →