From 439d8df618af9e2d1f98ec8f6e17e3dbd4661df4 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Tue, 30 May 2023 21:24:17 -0400 Subject: [PATCH] redo kubectl aliases --- modules/cli/kubernetes.nix | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/cli/kubernetes.nix b/modules/cli/kubernetes.nix index 832364c..91082ea 100644 --- a/modules/cli/kubernetes.nix +++ b/modules/cli/kubernetes.nix @@ -1,18 +1,8 @@ { config, pkgs, lib, ... }: { programs.bash.interactiveShellInit = '' - kc(){ - export KUBECONFIG=~/.kube/config."$1" - kubectl get nodes - } - _kc_completion(){ - [ "''${#COMP_WORDS[@]}" != "2" ] || - COMPREPLY=($(compgen -W "$(ls ~/.kube/ | grep '^config\.' | sed 's/^config\.//g')" -- "''${COMP_WORDS[1]}")) - } - complete -F _kc_completion kc source <(kubectl completion bash) complete -F __start_kubectl k - alias k=kubectl ''; environment.systemPackages = with pkgs; [ kubectl @@ -21,5 +11,7 @@ (google-cloud-sdk.withExtraComponents [ google-cloud-sdk.components.gke-gcloud-auth-plugin ]) + # dedicated script, because bash aliases dont work with `watch` + (writeShellScriptBin "k" "exec kubectl \"$@\"") ]; }