Adding dependency checker for kubectx and kubens (#92)

Ensure kubectl in PATH for kubectx and kubens.
This commit is contained in:
Ahmet Alp Balkan 2018-10-22 10:10:08 -07:00 committed by GitHub
commit 517dae9fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -159,6 +159,10 @@ delete_context() {
}
main() {
if ! hash kubectl 2>/dev/null; then
echo >&2 "kubectl is not installed"
exit 1
fi
if [[ "$#" -eq 0 ]]; then
if [[ -t 1 && -z "${KUBECTX_IGNORE_FZF:-}" && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then
choose_context_interactive

4
kubens
View File

@ -156,6 +156,10 @@ swap_namespace() {
}
main() {
if ! hash kubectl 2>/dev/null; then
echo >&2 "kubectl is not installed"
exit 1
fi
if [[ "$#" -eq 0 ]]; then
if [[ -t 1 && -z ${KUBECTX_IGNORE_FZF:-} && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then
choose_namespace_interactive