mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
redo kubectl aliases
This commit is contained in:
parent
f32971a8fa
commit
439d8df618
1 changed files with 2 additions and 10 deletions
|
@ -1,18 +1,8 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
programs.bash.interactiveShellInit = ''
|
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)
|
source <(kubectl completion bash)
|
||||||
complete -F __start_kubectl k
|
complete -F __start_kubectl k
|
||||||
alias k=kubectl
|
|
||||||
'';
|
'';
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
kubectl
|
kubectl
|
||||||
|
@ -21,5 +11,7 @@
|
||||||
(google-cloud-sdk.withExtraComponents
|
(google-cloud-sdk.withExtraComponents
|
||||||
[ google-cloud-sdk.components.gke-gcloud-auth-plugin ])
|
[ google-cloud-sdk.components.gke-gcloud-auth-plugin ])
|
||||||
|
|
||||||
|
# dedicated script, because bash aliases dont work with `watch`
|
||||||
|
(writeShellScriptBin "k" "exec kubectl \"$@\"")
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue