From ccc077b6c5a1b0310f442165fcc6a1776c9be4ce Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 31 Aug 2018 17:39:43 -0500 Subject: [PATCH] allow disabling interactive mode with fzf (#82) Introduce KUBECTX_IGNORE_FZF for both kubectx/kubens to force-disable attempt to enable interactive mode and lookup for fzf(1). --- README.md | 3 +++ kubectx | 2 +- kubens | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0960308..52071f6 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,9 @@ with fuzzy searching, you just need to [install ![kubectx interactive search with fzf](img/kubectx-interactive.gif) +If you have `fzf` installed, but want to opt out of using this feature, set the environment variable `KUBECTX_IGNORE_FZF=1`. + + ----- ### Customizing colors diff --git a/kubectx b/kubectx index 5930efd..9d753c9 100755 --- a/kubectx +++ b/kubectx @@ -160,7 +160,7 @@ delete_context() { main() { if [[ "$#" -eq 0 ]]; then - if [[ -t 1 && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then + if [[ -t 1 && -z "${KUBECTX_IGNORE_FZF:-}" && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then choose_context_interactive else list_contexts diff --git a/kubens b/kubens index 3943773..793423d 100755 --- a/kubens +++ b/kubens @@ -157,7 +157,7 @@ swap_namespace() { main() { if [[ "$#" -eq 0 ]]; then - if [[ -t 1 && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then + if [[ -t 1 && -z ${KUBECTX_IGNORE_FZF:-} && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then choose_namespace_interactive else list_namespaces