1
0
Fork 0
mirror of https://gitlab.com/mlunax/dotfiles.git synced 2025-04-12 05:40:17 +00:00

Add lazy loading and autocompletion for kubectl

This commit is contained in:
Luna 2023-11-08 01:27:18 +01:00
parent 1637bf21f7
commit e85afcb364

19
.zsh/lazy.zsh Normal file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env zsh
# Check if 'kubectl' is a command in $PATH
if [ $commands[kubectl] ]; then
# Placeholder 'kubectl' shell function:
# Will only be executed on the first call to 'kubectl'
kubectl() {
# Remove this function, subsequent calls will execute 'kubectl' directly
unfunction "$0"
# Load auto-completion
source <(kubectl completion zsh)
# Execute 'kubectl' binary
$0 "$@"
}
fi