fix(tools/magrathea): allow specifying just a target for mg run

Resolves b/232.

Change-Id: I4a32e4fe90c819e3fc98da35d370c84b2f3d3722
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8842
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
sterni 2023-06-22 13:05:20 +02:00 committed by clbot
parent aedb609368
commit 227dc9421f

View file

@ -335,6 +335,7 @@ if you meant to pass these arguments to nix, please separate them with
(match args (match args
[() (execute-run (empty-target))] [() (execute-run (empty-target))]
[("--" . rest) (execute-run (empty-target) rest)] [("--" . rest) (execute-run (empty-target) rest)]
[(target) (execute-run (guarantee-success (parse-target target)))]
[(target . ("--" . rest)) (execute-run (guarantee-success (parse-target target)) rest)] [(target . ("--" . rest)) (execute-run (guarantee-success (parse-target target)) rest)]
;; TODO(sterni): flag for selecting binary name ;; TODO(sterni): flag for selecting binary name
[_ (mg-error "usage: mg run [<target>] [-- <arguments>] (hint: use \"--\" to separate the `mg run [<target>]` invocation from the arguments you're passing to the built executable)")])) [_ (mg-error "usage: mg run [<target>] [-- <arguments>] (hint: use \"--\" to separate the `mg run [<target>]` invocation from the arguments you're passing to the built executable)")]))