graphql-engine/scripts/parse-pytest-backend
Abby Sassel dc950eda6a server/test: fix BACKEND variable in dev.sh script
GitOrigin-RevId: 0dae37c0aa50c8e4be59618d9d0a777f537fa4dc
2021-06-09 09:51:07 +00:00

50 lines
683 B
Bash

#!/usr/bin/env bash
PARAMS=""
BACKEND="${BACKEND:-postgres}"
die_backends() {
cat <<EOL
Invalid --backend argument. Available backends:
postgres (default)
bigquery
citus
mssql
EOL
exit 1
}
while (( "$#" )); do
case "$1" in
--backend)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
BACKEND=$2
shift 2
fi
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
# validate backend argument
case "$BACKEND" in
postgres)
;;
bigquery)
;;
citus)
;;
mssql)
;;
*)
die_backends
;;
esac
# set positional arguments in their proper place
eval set -- "$PARAMS"
export BACKEND