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 <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-08-24 09:28:00 -07:00 committed by GitHub
parent 46d593305a
commit f01719a5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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

3
kubens
View File

@ -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