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.
Generate completions
Section titled “Generate completions”polytoken completions bashReplace bash with zsh, fish, powershell, or elvish for the corresponding shell.
Install completions
Section titled “Install completions”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.
polytoken completions bash > ~/.local/share/bash-completion/completions/polytokenRestart 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:
fpath+=~/.zfuncThen generate the completion:
polytoken completions zsh > ~/.zfunc/_polytokenRestart your shell or run autoload -Uz compinit && compinit to activate completions.
polytoken completions fish > ~/.config/fish/completions/polytoken.fishFish loads completions automatically. Restart your shell to activate completions in the current session.
PowerShell
Section titled “PowerShell”Append to your PowerShell profile rather than overwriting it:
polytoken completions powershell | Add-Content -Path $PROFILEReload the profile to activate completions:
. $PROFILEElvish
Section titled “Elvish”polytoken completions elvish > ~/.config/elvish/lib/polytoken.elvRestart your shell or run use polytoken to activate completions.
Requirements
Section titled “Requirements”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.