mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
Merge pull request #2412 from dingxiangfei2009/patch-repl-autoargs
nix repl respects --arg and --argstr
This commit is contained in:
commit
5b2fdfdca2
1 changed files with 3 additions and 2 deletions
|
@ -31,6 +31,7 @@ struct NixRepl
|
||||||
{
|
{
|
||||||
string curDir;
|
string curDir;
|
||||||
EvalState state;
|
EvalState state;
|
||||||
|
Bindings * autoArgs;
|
||||||
|
|
||||||
Strings loadedFiles;
|
Strings loadedFiles;
|
||||||
|
|
||||||
|
@ -446,8 +447,7 @@ void NixRepl::loadFile(const Path & path)
|
||||||
loadedFiles.push_back(path);
|
loadedFiles.push_back(path);
|
||||||
Value v, v2;
|
Value v, v2;
|
||||||
state.evalFile(lookupFileArg(state, path), v);
|
state.evalFile(lookupFileArg(state, path), v);
|
||||||
Bindings & bindings(*state.allocBindings(0));
|
state.autoCallFunction(*autoArgs, v, v2);
|
||||||
state.autoCallFunction(bindings, v, v2);
|
|
||||||
addAttrsToScope(v2);
|
addAttrsToScope(v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,6 +699,7 @@ struct CmdRepl : StoreCommand, MixEvalArgs
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto repl = std::make_unique<NixRepl>(searchPath, openStore());
|
auto repl = std::make_unique<NixRepl>(searchPath, openStore());
|
||||||
|
repl->autoArgs = getAutoArgs(repl->state);
|
||||||
repl->mainLoop(files);
|
repl->mainLoop(files);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue