mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-27 07:46:49 +00:00
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:
parent
46d593305a
commit
f01719a5a6
3
kubectx
3
kubectx
@ -21,6 +21,7 @@
|
|||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
SELF_CMD="$0"
|
||||||
KUBECTX="${HOME}/.kube/kubectx"
|
KUBECTX="${HOME}/.kube/kubectx"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@ -91,7 +92,7 @@ switch_context() {
|
|||||||
|
|
||||||
choose_context_interactive() {
|
choose_context_interactive() {
|
||||||
local choice
|
local choice
|
||||||
choice="$(FZF_DEFAULT_COMMAND='kubectx' fzf --ansi || true)"
|
choice="$(FZF_DEFAULT_COMMAND="${SELF_CMD}" fzf --ansi || true)"
|
||||||
if [[ -z "${choice}" ]]; then
|
if [[ -z "${choice}" ]]; then
|
||||||
echo 2>&1 "error: you did not choose any of the options"
|
echo 2>&1 "error: you did not choose any of the options"
|
||||||
exit 1
|
exit 1
|
||||||
|
3
kubens
3
kubens
@ -21,6 +21,7 @@
|
|||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
SELF_CMD="$0"
|
||||||
KUBENS_DIR="${HOME}/.kube/kubens"
|
KUBENS_DIR="${HOME}/.kube/kubens"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@ -95,7 +96,7 @@ choose_namespace_interactive() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local choice
|
local choice
|
||||||
choice="$(FZF_DEFAULT_COMMAND='kubens' fzf --ansi || true)"
|
choice="$(FZF_DEFAULT_COMMAND="${SELF_CMD}" fzf --ansi || true)"
|
||||||
if [[ -z "${choice}" ]]; then
|
if [[ -z "${choice}" ]]; then
|
||||||
echo 2>&1 "error: you did not choose any of the options"
|
echo 2>&1 "error: you did not choose any of the options"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user