Completions

Shell completion lets your shell suggest cihai commands and options as you type.

cihai-cli 0.15+ (experimental)

Note

See the shtab library’s documentation on shell completion for the most up to date way of connecting completion for cihai-cli.

Provisional support for completions in cihai-cli 0.15+ is powered by shtab. This must be installed separately, as it’s not currently bundled with cihai-cli.

$ pip install shtab --user

Or manage it inside an existing project with uv:

$ uv add --dev shtab

Install shtab as a user-wide tool with uv:

$ uv tool install shtab

Run it on-demand without installing:

$ uvx shtab

Each shell command below points shtab at cihai_cli.cli.create_parser(), the parser factory used by cihai-cli.

$ shtab --shell=bash -u cihai_cli.cli.create_parser \
  | sudo tee "$BASH_COMPLETION_COMPAT_DIR"/CIHAI
$ shtab --shell=zsh -u cihai_cli.cli.create_parser \
  | sudo tee /usr/local/share/zsh/site-functions/_CIHAI
$ shtab --shell=tcsh -u cihai_cli.cli.create_parser \
  | sudo tee /etc/profile.d/CIHAI.completion.csh

You can stop here if you are installing completions for cihai-cli 0.15 or newer.

cihai-cli 0.2 to 0.14

Note

See the click library’s documentation on shell completion for the most up to date way of connecting completion for cihai.

cihai-cli 0.2 to 0.14 use click’s completion:

~/.bashrc:

$ eval "$(_CIHAI_COMPLETE=bash_source cihai)"

~/.zshrc:

$ eval "$(_CIHAI_COMPLETE=zsh_source cihai)"