Skip to content

CLI

CLI Shell Completions

Enable tab completion for kubeadapt in Bash, Zsh, Fish, and PowerShell. Includes persistent setup instructions for each shell.

Last updated


kubeadapt can generate completion scripts for Bash, Zsh, Fish, and PowerShell. Once installed, pressing Tab completes command names, flags, fixed flag values (such as --status and --kind), and resource IDs for cluster, workload, node, recommendation, team, and department arguments. ID completion calls the API with your stored credentials and gives up after 2 seconds.

Bash

Source the completion script in your current session:

bash
source <(kubeadapt completion bash)

To make it permanent on Linux, write the script to the completions directory:

bash
kubeadapt completion bash > /etc/bash_completion.d/kubeadapt

On macOS with Homebrew:

bash
kubeadapt completion bash > $(brew --prefix)/etc/bash_completion.d/kubeadapt

Then restart your shell or run source ~/.bashrc.

Zsh

Source the completion script in your current session:

bash
source <(kubeadapt completion zsh)

To make it permanent, write the script to a directory on your fpath:

bash
kubeadapt completion zsh > "${fpath[1]}/_kubeadapt"

Then restart your shell.

Fish

Source the completion script in your current session:

bash
kubeadapt completion fish | source

To make it permanent, write the script to the Fish completions directory:

bash
kubeadapt completion fish > ~/.config/fish/completions/kubeadapt.fish

Fish picks up completions in that directory automatically on the next shell start.

PowerShell

Source the completion script in your current session:

powershell
kubeadapt completion powershell | Out-String | Invoke-Expression

To make it permanent, add that line to your PowerShell profile ($PROFILE). If the profile file doesn't exist yet, create it first:

powershell
New-Item -ItemType File -Path $PROFILE -Force
Add-Content $PROFILE 'kubeadapt completion powershell | Out-String | Invoke-Expression'