Skip to content

Commit

Permalink
setup.sh: update arg parsing to add support for `flutter-version-file…
Browse files Browse the repository at this point in the history
…` as `-f pubspec.yaml`
  • Loading branch information
bartekpacia committed Apr 1, 2024
1 parent 8d4f976 commit d1718c2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion setup.sh
Expand Up @@ -76,8 +76,9 @@ PRINT_ONLY=""
TEST_MODE=false
ARCH=""
VERSION=""
VERSION_FILE=""

while getopts 'tc:k:d:l:pa:n:' flag; do
while getopts 'tc:k:d:l:pa:n:f:' flag; do
case "$flag" in
c) CACHE_PATH="$OPTARG" ;;
k) CACHE_KEY="$OPTARG" ;;
Expand All @@ -87,12 +88,24 @@ while getopts 'tc:k:d:l:pa:n:' flag; do
t) TEST_MODE=true ;;
a) ARCH="$(echo "$OPTARG" | awk '{print tolower($0)}')" ;;
n) VERSION="$OPTARG" ;;
f) VERSION_FILE="$OPTARG" ;;
?) exit 2 ;;
esac
done

[ -z "$ARCH" ] && ARCH="$ARCH_NAME"



if [ -n "$VERSION_FILE" ]; then
if [ -n "$VERSION" ]; then
echo "Cannot specify both a version and a version file"
exit 1
fi

VERSION="$(yq '.environment.flutter' "$VERSION_FILE")"
fi

ARR_CHANNEL=("${@:$OPTIND:1}")
CHANNEL="${ARR_CHANNEL[0]}"

Expand Down

0 comments on commit d1718c2

Please sign in to comment.