Add support of command-line-arguments to run.sh

This commit is contained in:
JustArchi 2016-07-24 02:48:49 +02:00
parent 0714c4e575
commit 85a70911e1

11
run.sh
View file

@ -2,12 +2,14 @@
set -eu
BUILD="Release"
UNTIL_CLEAN_EXIT=0
ASF_ARGS=()
MONO_ARGS=("--llvm" "--server" "-O=all")
PRINT_USAGE() {
echo "Usage: $0 [--until-clean-exit] [debug/release]"
echo "Usage: $0 [--until-clean-exit] [--cryptkey=] [--path=] [--server] [debug/release]"
exit 1
}
@ -15,6 +17,9 @@ for ARG in "$@"; do
case "$ARG" in
release|Release) BUILD="Release" ;;
debug|Debug) BUILD="Debug" ;;
--cryptkey=*) ASF_ARGS+=("--cryptkey=$(echo "$ARG" | cut -d '=' -f 2-)") ;;
--path=*) ASF_ARGS+=("--path=$(echo "$ARG" | cut -d '=' -f 2-)") ;;
--server) ASF_ARGS+=("--server") ;;
--until-clean-exit) UNTIL_CLEAN_EXIT=1 ;;
*) PRINT_USAGE
esac
@ -34,12 +39,12 @@ if [[ ! -f "$BINARY" ]]; then
fi
if [[ "$UNTIL_CLEAN_EXIT" -eq 0 ]]; then
mono "${MONO_ARGS[@]}" "$BINARY"
mono "${MONO_ARGS[@]}" "$BINARY" "${ASF_ARGS[@]}"
exit $?
fi
while [[ -f "$BINARY" ]]; do
if mono "${MONO_ARGS[@]}" "$BINARY"; then
if mono "${MONO_ARGS[@]}" "$BINARY" "${ASF_ARGS[@]}"; then
break
fi
sleep 1