From f01719a5a650687da47b8068b997ac097822a230 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Fri, 24 Aug 2018 09:28:00 -0700 Subject: [PATCH] fix: --with-short-names not compatible with fzf (#79) When kubectx is installed as kctx, FZF_DEFAULT_COMMAND=kubectx won't work. Fixes #78. Signed-off-by: Ahmet Alp Balkan --- kubectx | 3 ++- kubens | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kubectx b/kubectx index 32d37756..5930efd3 100755 --- a/kubectx +++ b/kubectx @@ -21,6 +21,7 @@ set -eou pipefail IFS=$'\n\t' +SELF_CMD="$0" KUBECTX="${HOME}/.kube/kubectx" usage() { @@ -91,7 +92,7 @@ switch_context() { choose_context_interactive() { local choice - choice="$(FZF_DEFAULT_COMMAND='kubectx' fzf --ansi || true)" + choice="$(FZF_DEFAULT_COMMAND="${SELF_CMD}" fzf --ansi || true)" if [[ -z "${choice}" ]]; then echo 2>&1 "error: you did not choose any of the options" exit 1 diff --git a/kubens b/kubens index 30331be7..3943773d 100755 --- a/kubens +++ b/kubens @@ -21,6 +21,7 @@ set -eou pipefail IFS=$'\n\t' +SELF_CMD="$0" KUBENS_DIR="${HOME}/.kube/kubens" usage() { @@ -95,7 +96,7 @@ choose_namespace_interactive() { fi local choice - choice="$(FZF_DEFAULT_COMMAND='kubens' fzf --ansi || true)" + choice="$(FZF_DEFAULT_COMMAND="${SELF_CMD}" fzf --ansi || true)" if [[ -z "${choice}" ]]; then echo 2>&1 "error: you did not choose any of the options" exit 1