set -o errexit -o nounset -o pipefail
function main {
case "${1:-${TRAVIS_OS_NAME:-}}" in
osx) osx ;;
*) echo "No handler for: ${1:-}" >&2
esac
}
function osx {
BREW_LOG=brew.log
brew update > "$BREW_LOG"
brew remove postgresql >> "$BREW_LOG"
brew upgrade >> "$BREW_LOG"
}
function msg { out "$*" >&2 ;}
function err { local x=$? ; msg "$*" ; return $(( $x == 0 ? 1 : $x )) ;}
function out { printf '%s\n' "$*" ;}
function maybe { "$@" || return $(( $? == 1 ? 0 : $? )) ;}
if declare -f -- "${1:-}" >/dev/null
then "$@"
else main "$@"
fi