From c849ef0083b7ee7dff699c07e0b275aa7cecde97 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 29 Mar 2017 00:12:58 -0700 Subject: [PATCH] Better if organization in main() Signed-off-by: Ahmet Alp Balkan --- kubectx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kubectx b/kubectx index 923615d..9260fc9 100755 --- a/kubectx +++ b/kubectx @@ -129,6 +129,9 @@ alias_context() { main() { if [[ "$#" -eq 0 ]]; then list_contexts + elif [[ "$#" -gt 1 ]]; then + echo "error: too many flags" >&2 + usage elif [[ "$#" -eq 1 ]]; then if [[ "${1}" == "-" ]]; then swap_context @@ -141,12 +144,9 @@ main() { else set_context "${1}" fi - elif [[ "$#" -gt 1 ]]; then - echo "error: too many flags" >&2 - usage else usage - fi + fi } main "$@"