open Core let repl = Command.basic ~summary:"run the Mininix REPL" (Command.Param.return Repl.run) let eval = Command.basic ~summary:"run a Nix file" (let%map_open.Command filename = anon ("FILENAME" %: string) and strict = flag "strict" no_arg ~doc:"use deep evaluation strategy" and importsdef = flag "importsdef" (optional string) ~doc:"import tree definition file" in fun () -> Settings.opts.eval_strategy := if strict then `Deep else `Shallow; Settings.opts.imports_def_file := importsdef; let ok = if String.(filename = "-") then Run.eval_stdin () else Run.eval_file filename in if ok then exit 0 else exit 1) let main = Command.group ~summary:"the Mininix interpreter" [ ("repl", repl); ("eval", eval) ] let () = Command_unix.run main