Skip to content

Commit 9cac33b

Browse files
committed
Improve use of fzf in k8s helpers
1 parent 302a169 commit 9cac33b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.zshrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export EDITOR="nano"
6767
export LANG="en_US.UTF-8"
6868
export TERM="xterm-256color"
6969
export COLORTERM="truecolor"
70+
export FZF_DEFAULT_OPTS='--reverse --prompt="→ " --height="30%"'
7071

7172
# Go env
7273
export GOPROXY=direct
@@ -477,7 +478,7 @@ function k8s_namespace() {
477478

478479
if [[ $# -eq 0 ]] ; then
479480
if [[ -f "$HOME/.bin/fzf" || -d "$HOME/.fzf" ]] ; then
480-
ns=$(kubectl get ns | grep -vE '(kube|yandex)' | fzf --header-lines=1 --height 20% --reverse | awk '{print $1}')
481+
ns=$(kubectl get ns | grep -vE '(kube|yandex)' | fzf --header-lines=1 --cycle --preview='kubectl describe ns {1}' | awk '{print $1}')
481482

482483
if [[ -z "$ns" ]] ; then
483484
return 1
@@ -515,7 +516,7 @@ function k8s_log() {
515516

516517
if [[ "${1:0:1}" == "-" || -z "$resource" ]] ; then
517518
if [[ -f "$HOME/.bin/fzf" || -d "$HOME/.fzf" ]] ; then
518-
resource=$(kubectl get pods | fzf --header-lines=1 --height 20% --reverse | awk '{print $1}')
519+
resource=$(kubectl get pods | fzf --header-lines=1 --cycle --preview='kubectl describe pod {1}' | awk '{print $1}')
519520

520521
if [[ -z "$resource" ]] ; then
521522
return 1
@@ -554,7 +555,7 @@ function k8s_shell() {
554555

555556
if [[ $# -eq 0 ]] ; then
556557
if [[ -f "$HOME/.bin/fzf" || -d "$HOME/.fzf" ]] ; then
557-
pod=$(kubectl get pods --field-selector='status.phase=Running' | fzf --header-lines=1 --height 20% --reverse | awk '{print $1}')
558+
pod=$(kubectl get pods --field-selector='status.phase=Running' | fzf --header-lines=1 --cycle --preview='kubectl describe pod {1}' | awk '{print $1}')
558559

559560
if [[ -z "$pod" ]] ; then
560561
return 1

0 commit comments

Comments
 (0)