PowerShell
For PowerShell (pwsh
) add the following lines to your profile ($PROFILE
):
# Set aliasesSet-Alias -Name kubectl -Value kubecolorSet-Alias -Name k -Value kubectl
Completions
Completion can be easily borrowed from the kubectl
command by adding this to your profile:
# Reuse the kubectl completion on kubecolor and the aliasesRegister-ArgumentCompleter -CommandName 'k','kubectl','kubecolor' -ScriptBlock $__kubectlCompleterBlock
As a prerequisite, you need kubectl
completions installed.
This can be achieved by adding this to your profile:
# Completion for kubectl# This needs to be added before Register-ArgumentCompleterif (Get-Command kubectl -ErrorAction SilentlyContinue) { # This also registers the $__kubectlCompleterBlock variable kubectl completion powershell | Out-String | Invoke-Expression}