forked from lix-project/lix
move repl.cc to libcmd for linkage
This commit is contained in:
parent
57c2dd5d85
commit
f32c687f03
|
@ -54,6 +54,7 @@ void StoreCommand::run()
|
||||||
run(getStore());
|
run(getStore());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
EvalCommand::EvalCommand()
|
EvalCommand::EvalCommand()
|
||||||
{
|
{
|
||||||
addFlag({
|
addFlag({
|
||||||
|
@ -77,6 +78,42 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
}
|
}
|
||||||
return ref<EvalState>(evalState);
|
return ref<EvalState>(evalState);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
EvalCommand::EvalCommand()
|
||||||
|
{
|
||||||
|
addFlag({
|
||||||
|
.longName = "debugger",
|
||||||
|
.description = "start an interactive environment if evaluation fails",
|
||||||
|
.handler = {&startReplOnEvalErrors, true},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// ref<EvalState> EvalCommand::getEvalState()
|
||||||
|
// {
|
||||||
|
// if (!evalState)
|
||||||
|
// evalState = std::make_shared<EvalState>(searchPath, getStore());
|
||||||
|
// return ref<EvalState>(evalState);
|
||||||
|
// }
|
||||||
|
extern std::function<void(const Error & error, const std::map<std::string, Value *> & env)> debuggerHook;
|
||||||
|
|
||||||
|
ref<EvalState> EvalCommand::getEvalState()
|
||||||
|
{
|
||||||
|
if (!evalState) {
|
||||||
|
evalState = std::make_shared<EvalState>(searchPath, getStore());
|
||||||
|
if (startReplOnEvalErrors)
|
||||||
|
debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error & error, const std::map<std::string, Value *> & env) {
|
||||||
|
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what());
|
||||||
|
runRepl(evalState, env);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return ref<EvalState>(evalState);
|
||||||
|
}
|
||||||
|
|
||||||
|
EvalCommand::~EvalCommand()
|
||||||
|
{
|
||||||
|
if (evalState)
|
||||||
|
evalState->printStats();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RealisedPathsCommand::RealisedPathsCommand(bool recursive)
|
RealisedPathsCommand::RealisedPathsCommand(bool recursive)
|
||||||
: recursive(recursive)
|
: recursive(recursive)
|
||||||
|
|
|
@ -6,10 +6,10 @@ libcmd_DIR := $(d)
|
||||||
|
|
||||||
libcmd_SOURCES := $(wildcard $(d)/*.cc)
|
libcmd_SOURCES := $(wildcard $(d)/*.cc)
|
||||||
|
|
||||||
libcmd_CXXFLAGS += -I src/libutil -I src/libstore -I src/libexpr -I src/libmain -I src/libfetchers
|
libcmd_CXXFLAGS += -I src/libutil -I src/libstore -I src/libexpr -I src/libmain -I src/libfetchers -I src/nix
|
||||||
|
|
||||||
libcmd_LDFLAGS = -llowdown
|
libcmd_LDFLAGS = $(EDITLINE_LIBS) -llowdown
|
||||||
|
|
||||||
libcmd_LIBS = libstore libutil libexpr libmain libfetchers
|
libcmd_LIBS = libstore libutil libexpr libmain libfetchers libnix libwut
|
||||||
|
|
||||||
$(eval $(call install-file-in, $(d)/nix-cmd.pc, $(prefix)/lib/pkgconfig, 0644))
|
$(eval $(call install-file-in, $(d)/nix-cmd.pc, $(prefix)/lib/pkgconfig, 0644))
|
||||||
|
|
Loading…
Reference in a new issue