feat(kubernetes): Guard kubectl initialization and completions

Ensures kubectl-related aliases and functions are only sourced if the `kubectl` command is available.
This commit is contained in:
2026-04-16 19:21:35 +02:00
parent 2c0ac0f6ab
commit 5e4a8464c5

View File

@@ -1,3 +1,4 @@
if command -v kubectl >/dev/null 2>&1; then
source <(kubectl completion bash) source <(kubectl completion bash)
alias k="kubectl" alias k="kubectl"
alias kcontext="kubectl config use-context" alias kcontext="kubectl config use-context"
@@ -23,3 +24,4 @@ _kcontext_completion() {
complete -F __start_kubectl k complete -F __start_kubectl k
complete -F _kns_completion kns complete -F _kns_completion kns
complete -F _kcontext_completion kcontext complete -F _kcontext_completion kcontext
fi