mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-07-19 09:39:36 +00:00
Better if organization in main()
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
aca0536725
commit
c849ef0083
8
kubectx
8
kubectx
@ -129,6 +129,9 @@ alias_context() {
|
|||||||
main() {
|
main() {
|
||||||
if [[ "$#" -eq 0 ]]; then
|
if [[ "$#" -eq 0 ]]; then
|
||||||
list_contexts
|
list_contexts
|
||||||
|
elif [[ "$#" -gt 1 ]]; then
|
||||||
|
echo "error: too many flags" >&2
|
||||||
|
usage
|
||||||
elif [[ "$#" -eq 1 ]]; then
|
elif [[ "$#" -eq 1 ]]; then
|
||||||
if [[ "${1}" == "-" ]]; then
|
if [[ "${1}" == "-" ]]; then
|
||||||
swap_context
|
swap_context
|
||||||
@ -141,12 +144,9 @@ main() {
|
|||||||
else
|
else
|
||||||
set_context "${1}"
|
set_context "${1}"
|
||||||
fi
|
fi
|
||||||
elif [[ "$#" -gt 1 ]]; then
|
|
||||||
echo "error: too many flags" >&2
|
|
||||||
usage
|
|
||||||
else
|
else
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user