Better if organization in main()

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2017-03-29 00:12:58 -07:00
parent aca0536725
commit c849ef0083
No known key found for this signature in database
GPG Key ID: 5C02521D7B216AD6

View File

@ -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 "$@"