The completions command
ct
supports generating completion scripts for Bash, Fish, Zsh, and PowerShell.
See ct help completions
for full details, but the gist is as simple as using
one of the following:
# Bash
$ ct completions bash > /etc/bash_completion.d/ct.bash-completion
# Bash (macOS/Homebrew)
$ ct completions bash > $(brew --prefix)/etc/bash_completion.d/ct.bash-completion
# Fish
$ ct completions fish > ~/.config/fish/completions/ct.fish
# Zsh
$ ct completions zsh > ~/.zfunc/_ct
# PowerShell v5.0+
$ ct completions powershell >> $PROFILE.CurrentUserCurrentHost
# or
$ ct completions powershell | Out-String | Invoke-Expression
Note: you may need to restart your shell in order for the changes to take effect.
For zsh
, you must then add the following line in your ~/.zshrc
before
compinit
:
fpath+=~/.zfunc