mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-09-15 07:19:01 +00:00
Better if organization in main()
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
8
kubectx
8
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 "$@"
|
||||
|
Reference in New Issue
Block a user