Skip to content

Shell completions

hwt can generate completion scripts for Bash, Zsh, Fish, and PowerShell.

Install and initialize bash-completion first. Cobra’s generated Bash script depends on it.

Load completions in the current shell:

Terminal window
source <(hwt completion bash)

Install them for future sessions:

Terminal window
mkdir -p ~/.local/share/bash-completion/completions
hwt completion bash > ~/.local/share/bash-completion/completions/hwt

Add a completion directory to fpath in ~/.zshrc:

Terminal window
fpath=(~/.zfunc $fpath)
autoload -Uz compinit
compinit

Then generate the completion file:

Terminal window
mkdir -p ~/.zfunc
hwt completion zsh > ~/.zfunc/_hwt

Start a new shell or run exec zsh after installing it.

Terminal window
mkdir -p ~/.config/fish/completions
hwt completion fish > ~/.config/fish/completions/hwt.fish

Fish discovers the file automatically in new and existing sessions.

Load completions in the current session:

Terminal window
hwt completion powershell | Out-String | Invoke-Expression

Add the same command to $PROFILE to load completions in future sessions.