From 89f3f0a5dc710c891a422d530c18a58aa2d336fb Mon Sep 17 00:00:00 2001 From: sterni Date: Wed, 1 Jun 2022 12:27:59 +0200 Subject: feat(tools/magrathea): add repl command `mg repl` is essentially a shortcut for nix repl $(mg path //) which comes up often enough for me. Launching a repl only really makes sense in the repository root with how readTree works at the moment, so I think this is a convenient addition. Change-Id: I32b695885c2e6eaecdcc656c7249afa504439913 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5822 Autosubmit: sterni Reviewed-by: tazjin Tested-by: BuildkiteCI --- tools/magrathea/mg.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/magrathea/mg.scm b/tools/magrathea/mg.scm index cbbcfc69dd..ab8e5bb77e 100644 --- a/tools/magrathea/mg.scm +++ b/tools/magrathea/mg.scm @@ -39,6 +39,7 @@ commands: build - build a target shell - enter a shell with the target's build dependencies path - print source folder for the target + repl - start a nix repl in the repository root run - build a target and execute its output file all feedback on b.tvl.fyi @@ -289,6 +290,9 @@ if you meant to pass these arguments to nix, please separate them with (guarantee-success (parse-target arg)))] [other (print "not yet implemented")])) +(define (repl args) + (process-execute "nix" (append (list "repl" "--show-trace" (repository-root)) args))) + (define (execute-run t #!optional cmd-args) (fprintf (current-error-port) "[mg] building target ~A~%" t) (let* ((expr (nix-expr-for t)) @@ -352,6 +356,7 @@ if you meant to pass these arguments to nix, please separate them with [("build" . _) (build (cdr args))] [("shell" . _) (shell (cdr args))] [("path" . _) (path (cdr args))] + [("repl" . _) (repl (cdr args))] [("run" . _) (run (cdr args))] [other (begin (print "unknown command: mg " args) (print usage))])) -- cgit 1.4.1