From 1bd03ad100e8813751b6c08b0c21ae8cf5a9c21d Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 3 Feb 2023 22:42:36 -0500 Subject: Split out `CmdRepl` and `editorFor` The REPL itself and the `nix repl` CLI are conceptually different things, and thus deserve to be in different files. --- src/libcmd/repl.hh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/libcmd/repl.hh (limited to 'src/libcmd/repl.hh') diff --git a/src/libcmd/repl.hh b/src/libcmd/repl.hh new file mode 100644 index 000000000..dfccc93e7 --- /dev/null +++ b/src/libcmd/repl.hh @@ -0,0 +1,39 @@ +#pragma once + +#include "eval.hh" + +#if HAVE_BOEHMGC +#define GC_INCLUDE_NEW +#include +#endif + +namespace nix { + +struct AbstractNixRepl +{ + ref state; + Bindings * autoArgs; + + AbstractNixRepl(ref state) + : state(state) + { } + + virtual ~AbstractNixRepl() + { } + + typedef std::vector> AnnotatedValues; + + static std::unique_ptr create( + const Strings & searchPath, nix::ref store, ref state, + std::function getValues); + + static void runSimple( + ref evalState, + const ValMap & extraEnv); + + virtual void initEnv() = 0; + + virtual void mainLoop() = 0; +}; + +} -- cgit v1.2.3