diff options
-rwxr-xr-x | Biz/Ide/repl | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/Biz/Ide/repl b/Biz/Ide/repl index 836bed9..0a6815f 100755 --- a/Biz/Ide/repl +++ b/Biz/Ide/repl @@ -2,35 +2,33 @@ # # a simple complement to bild which only deals with launching repls # -# > repl <target> +# > repl <target..> # -# Starts a repl/shell for target. -# -# - if target.hs, load ghci -# - TODO: if target.scm, load scheme repl -# - TODO: if target.nix, load 'nix repl' +# Starts a repl/shell for one or more targets. (Currently, all targets must have +# the same extension for this to work.) ## set -e - target=${1:?} - json=$(bild --json "$target") - langdeps=$(jq --raw-output '.[].langdeps | join(" ")' <<< $json) - case $target in - *.hs) + targets=${@:?} + json=$(bild --json ${targets[@]}) + langdeps=$(jq --raw-output '.langdeps | join(" ")' <<< $json) + exts=$(jq --raw-output '.namespace.ext' <<< $json | sort | uniq) + case $exts in + Hs) nix-shell \ - --packages "(import $BIZ_ROOT/Biz/Bild.nix {}).ghcWith (h: with h; [$langdeps])" \ - --command "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci $target" + --packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.ghcWith (h: with h; [$langdeps])" \ + --command "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci ${targets[@]}" ;; - *.scm) + Scm) echo "scheme repl not supported yet: $target" exit 1 ;; - *.lisp) - swank-lisp-launcher.sh \ - --eval "(asdf:load-system 'swank)" \ - --eval "(swank:create-server :dont-close t)" + Lisp) + swank-lisp-launcher.sh \ + --eval "(asdf:load-system 'swank)" \ + --eval "(swank:create-server :dont-close t)" ;; *) - echo "unsupported target: $target" + echo "unsupported targets: ${targets[@]}" exit 1 ;; esac |