From e368d13eea15a60f872e4e881eab75b43888735a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20List=C3=ADk?= Date: Mon, 20 Aug 2018 02:40:47 +0300 Subject: [PATCH] help exit status 0 (#72) --- kubectx | 5 ++++- kubens | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kubectx b/kubectx index c80a763..8d62317 100755 --- a/kubectx +++ b/kubectx @@ -37,7 +37,6 @@ USAGE: kubectx -h,--help : show this message EOF - exit 1 } current_context() { @@ -176,11 +175,13 @@ main() { if [[ "$#" -lt 2 ]]; then echo "error: missing context NAME" >&2 usage + exit 1 fi delete_contexts "${@:2}" elif [[ "$#" -gt 1 ]]; then echo "error: too many arguments" >&2 usage + exit 1 elif [[ "$#" -eq 1 ]]; then if [[ "${1}" == "-" ]]; then swap_context @@ -189,6 +190,7 @@ main() { elif [[ "${1}" =~ ^-(.*) ]]; then echo "error: unrecognized flag \"${1}\"" >&2 usage + exit 1 elif [[ "${1}" =~ (.+)=(.+) ]]; then rename_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}" else @@ -196,6 +198,7 @@ main() { fi else usage + exit 1 fi } diff --git a/kubens b/kubens index 6145e94..0eb21b2 100755 --- a/kubens +++ b/kubens @@ -31,7 +31,6 @@ USAGE: kubens - : switch to the previous namespace in this context kubens -h,--help : show this message EOF - exit 1 } current_namespace() { @@ -147,6 +146,7 @@ main() { elif [[ "${1}" =~ ^-(.*) ]]; then echo "error: unrecognized flag \"${1}\"" >&2 usage + exit 1 elif [[ "${1}" =~ (.+)=(.+) ]]; then alias_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}" else @@ -155,6 +155,7 @@ main() { else echo "error: too many flags" >&2 usage + exit 1 fi }