mirror of
https://gitlab.com/mlunax/dotfiles.git
synced 2025-04-12 05:40:17 +00:00
Add lazy loading for kubectl auto-completion
This commit is contained in:
parent
e15e7ae6d7
commit
b6d49d3d8c
3 changed files with 21 additions and 5 deletions
|
@ -1,5 +0,0 @@
|
|||
autoload -Uz compinit && compinit
|
||||
|
||||
if type "kubectl" > /dev/null; then
|
||||
source <(kubectl completion zsh)
|
||||
fi
|
19
.zsh/lazy.sh
Normal file
19
.zsh/lazy.sh
Normal 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
|
2
.zshrc
2
.zshrc
|
@ -1,3 +1,5 @@
|
|||
DISABLE_AUTO_UPDATE=true
|
||||
|
||||
iscmd() {
|
||||
command -v "$1" > /dev/null
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue