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).
This commit is contained in:
Oliver 2018-08-31 17:39:43 -05:00 committed by Ahmet Alp Balkan
parent d931779c0c
commit ccc077b6c5
3 changed files with 5 additions and 2 deletions

View File

@ -135,6 +135,9 @@ with fuzzy searching, you just need to [install
![kubectx interactive search with fzf](img/kubectx-interactive.gif) ![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 ### Customizing colors

View File

@ -160,7 +160,7 @@ delete_context() {
main() { main() {
if [[ "$#" -eq 0 ]]; then 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 choose_context_interactive
else else
list_contexts list_contexts

2
kubens
View File

@ -157,7 +157,7 @@ swap_namespace() {
main() { main() {
if [[ "$#" -eq 0 ]]; then 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 choose_namespace_interactive
else else
list_namespaces list_namespaces