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)
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.
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.
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>
This is previously offered in #18, #22, and #27 and I previously rejected
these PRs. My rationale was to prevent scripting around kubectx as it is
meant to be used as an interactive tool.
But clearly that will be a problem, when you're doing operations like:
kubectx -d $(kubectx)
which I proposed in #39. Plus this change is harmless. I think this
implementation does a better check than the previous ones.
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
Suggested by SC2155 (https://github.com/koalaman/shellcheck/wiki/SC2155).
It captures some of the errors from kubectl that were previously described
in #5. However, this doesn't completely address that.
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
BSD coreutils readlink doesn't have -f option, so
adding a Python one-liner feedback to eval symlinks/homedir.
Fixes#8.
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
Fixes#1. Now kubectx also ships with kubens.
Extracted utility functions to a utils.bash file, loaded
from ../include/utils.bash.
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>