From 9bbc9376aff4f7515f3c7e0c151a3b7cdf51afac Mon Sep 17 00:00:00 2001 From: Eric Conlon <37287+ejconlon@users.noreply.github.com> Date: Fri, 17 May 2024 13:28:20 -0700 Subject: [PATCH] update script --- bin/minipat | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/minipat b/bin/minipat index 53ab4da..021c096 100755 --- a/bin/minipat +++ b/bin/minipat @@ -5,7 +5,7 @@ set -e cd "$(dirname "$0")/.." DEFAULT_BACKEND="midi" -USE_STRING="minipat [BACKEND]" +USE_STRING="minipat [BACKEND [SCRIPT]]" if [ $# -eq 0 ]; then echo "No backend specified, using default backend ${DEFAULT_BACKEND}" @@ -23,5 +23,21 @@ if [ "${BACKEND}" == "help" ] || exit 0 fi -stack build --fast minipat-${BACKEND} -exec stack exec -- ghci -package minipat-${BACKEND} -ghci-script minipat-${BACKEND}/Repl.ghci +SCRIPT="minipat-${BACKEND}/Repl.ghci" + +if [ $# -ne 0 ]; then + SCRIPT="$1" + shift +fi + +if [ $# -ne 0 ]; then + echo "Unhandled arguments: $*" + echo "Use: ${USE_STRING}" + exit 1 +fi + +set -x + +stack build --fast "minipat-${BACKEND}" + +exec stack exec -- ghci -package "minipat-${BACKEND}" -ghci-script "${SCRIPT}"