Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 1.29 KB

completion.md

File metadata and controls

44 lines (28 loc) · 1.29 KB

Enabling shell autocompletion

The Kubebuilder completion script can be generated with the command kubebuilder completion [bash|fish|powershell|zsh]. Note that sourcing the completion script in your shell enables Kubebuilder autocompletion.

Prerequisites for Bash

The completion Bash script depends on bash-completion, which means that you have to install this software first (you can test if you have bash-completion already installed). Also, ensure that your Bash version is 4.1+.

  • Once installed, go ahead and add the path /usr/local/bin/bash in the /etc/shells.

    echo “/usr/local/bin/bash” > /etc/shells

  • Make sure to use installed shell by current user.

    chsh -s /usr/local/bin/bash

  • Add following content in /.bash_profile or ~/.bashrc

# kubebuilder autocompletion
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
fi
. <(kubebuilder completion bash)
  • Restart terminal for the changes to be reflected or source the changed bash file.

Zsh

Follow a similar protocol for zsh completion.

Fish

source (kubebuilder completion fish | psub)