Add kexec funtion to .zshrc

This commit is contained in:
Daniel Carrillo 2020-07-14 19:37:23 +02:00
parent 675c7853d8
commit 2ab0701f00
1 changed files with 12 additions and 0 deletions

12
.zshrc
View File

@ -70,6 +70,18 @@ dexec () {
[ -n "$cid" ] && docker exec -ti "$cid" "${cmd[@]}"
}
kexec () {
local cid
local cmd=("$@")
if [ -z "$1" ]; then
cmd=(bash)
fi
cid=$(kubectl get pods | sed 1d | fzf -1 | awk '{print $1}')
[ -n "$cid" ] && kubectl exec -ti "$cid" -- "${cmd[@]}"
}
export FZF_DEFAULT_COMMAND="fd --type f --follow -I"
export FZF_DEFAULT_OPTS="-m --reverse --bind 'ctrl-o:execute(xdg-open {})+abort,ctrl-e:execute({})+abort,ctrl-y:execute(echo {} | xclip -selection clipboard -in)+abort'"