Configures auto-completion for Tanzu CLI commands.
System command: completion
| Primarily used for: Tanzu CLI
Syntax:
tanzu completion SHELL
To enable auto-completion for Bash:
Note: Install the
bash-completion
OS package before following the steps below.
Load only for the current session:
source <(tanzu completion bash)
Load for all new sessions:
tanzu completion bash > $HOME/.config/tanzu/completion.bash.inc
printf "\n# Tanzu shell completion\nsource '$HOME/.config/tanzu/completion.bash.inc'\n" >> $HOME/.bashrc
If you invoke the tanzu
command using a different name or an alias such as, for example, tz
, you must also include the following in your $HOME/.bashrc
:
complete -o default -F __start_tanzu tz
To enable auto-completion for Zsh:
Load only for the current session:
autoload -U compinit; compinit
source <(tanzu completion zsh)
Load for all new sessions:
echo "autoload -U compinit; compinit" >> $HOME/.zshrc
tanzu completion zsh > "${fpath[1]}/_tanzu"
Aliases are handled automatically, but if you have renamed the tanzu
binary to, for example, tz
, you must also include the following in your $HOME/.zshrc
:
compdef _tanzu tz
To enable auto-completion for Fish:
Load only for current session:
tanzu completion fish | source
Load for all new sessions:
tanzu completion fish > $HOME/.config/fish/completions/tanzu.fish
Aliases are handled automatically, but if you have renamed the tanzu
binary to, for example, tz
, you must also include the following in your $HOME/.config/fish/config.fish
:
complete --command tz --wraps tanzu
To enable auto-completion for PowerShell:
Load only for current session:
tanzu completion powershell | Out-String | Invoke-Expression
Load for all new sessions:
printf "\n# Tanzu shell completion\ntanzu completion powershell | Out-String | Invoke-Expression" >> $PROFILE
If you invoke the tanzu
command using a different name or an alias such as, for example, tz
, you must also include the following in your PowerShell $PROFILE
:
Register-ArgumentCompleter -CommandName 'tz' -ScriptBlock ${__tanzuCompleterBlock}
-h, --help
Help text.
The Tanzu CLI prints ActiveHelp messages for auto-completions when you press TAB
. This feature is currently supported only for bash
and zsh
.
To deactivate all ActiveHelp messages, you can set the TANZU_ACTIVE_HELP
environment variable to 0
.