#!/bin/bash
set -e

run=false

TEMP=$(getopt --long -o "g" "$@")
eval set -- "$TEMP"
while true; do
  case "$1" in
  -g)
    run=true
    shift 2
    ;;
  *)
    break
    ;;
  esac
done

cargo install cargo-apk

if [ "$run" = true ] ; then
  cargo apk run --lib
else
  cargo apk build --lib
fi
