The user may have global settings that enable the preview pane in fzf.
Whatever the preview command is set as, it probably doesn't render
anything meaningful for kubens - I can't think what would be.
For kubectx, the context yaml itself would _maybe_ be helpful, but it
likely contains secrets, so I don't personally think I'd find it useful
enough to get into.
This commit thus disables the preview, so that if the user did have it
enabled, there's now no pane where there would previously have probably
been an error, such as:
[bat error]: '<namespace>': No such file or directory (os error 2)
Without this safeguard, when user runs `kubectx NEW_NAME=OLD_NAME` where
NEW_NAME is an existing context but OLD_NAME isn't, we end up deleting NEW_NAME
and not doing any renames (because OLD_NAME is not found).
Fixes#136.
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
- FIX: Show current context/ns color in interactive (fzf) mode. (#109)
- TEST: Add integration tests for kubectx (#111, #113) and kubens (#105, #117)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This patch introduces an internal _KUBECTX_FORCE_COLOR environment variable
that overrides color output decision.
With this, fzf output shows the color indicators for ctx/ns and choosing the
option with the color works without any extra handling.
Fixes#89.
Fixes#98.
- add .travis.yml.
- move bats fixtures to .bats extension, since it allows detection of test
files automatically by file extension.
- use BATS_TEST_DIRNAME variable to compute location of COMMAND.
- IMPORTANT: use `echo "$output">&2` before final check so that we can debug
the test cases by their output
Ref #2.
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
On the various flavors of bash for Windows kubectl won't resolve as the binary is kubectl.exe.
Simple aliasing doesn't seem to work. So test for both otherwise fail with a not found error.
- FEATURE: interactive search mode when kubectx and kubens are ran without any
arguments and fzf(1) is detected in PATH. (#71, #74)
- FIX: kubectx -d now doesn't ignore arguments after the first argument. (#75)
- FIX: empty output bug when TERM=vt100 even though NO_COLOR is set. (#57, #73)
- FIX: --help exits with code 0 now. (#69, #72)
Currently TERM=vt100 is causing kubectx failure since tput is returning
exitcode=1. vt100 does not have colors. Ignoring tput exit code.
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>