Skip to content

Shell Completions

Polytoken generates completion scripts for bash, zsh, fish, PowerShell, and Elvish. The completions command writes the script to stdout. Redirect the output to the location your shell expects.

Terminal window
polytoken completions bash

Replace bash with zsh, fish, powershell, or elvish for the corresponding shell.

The commands below write the completion script to the default location for each shell. Paths use the default $XDG_* directory; substitute if you have set the corresponding variable.

The bash-completion package must be installed on your system.

Terminal window
polytoken completions bash > ~/.local/share/bash-completion/completions/polytoken

Restart your shell or run source ~/.local/share/bash-completion/completions/polytoken to activate completions in the current session.

The directory containing the completion file must be on your fpath before compinit runs. Add this to your ~/.zshrc if it is not already present:

Terminal window
fpath+=~/.zfunc

Then generate the completion:

Terminal window
polytoken completions zsh > ~/.zfunc/_polytoken

Restart your shell or run autoload -Uz compinit && compinit to activate completions.

Terminal window
polytoken completions fish > ~/.config/fish/completions/polytoken.fish

Fish loads completions automatically. Restart your shell to activate completions in the current session.

Append to your PowerShell profile rather than overwriting it:

Terminal window
polytoken completions powershell | Add-Content -Path $PROFILE

Reload the profile to activate completions:

Terminal window
. $PROFILE
Terminal window
polytoken completions elvish > ~/.config/elvish/lib/polytoken.elv

Restart your shell or run use polytoken to activate completions.

The completions command requires no configuration. It works immediately after installation, before any provider or config setup. The command bypasses the first-run configurator and tracing, so stdout contains only the completion script.