diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-09-10T08·50+0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-10T08·50+0200 |
commit | 5b2fdfdca24df3132a4d92dd7b63e2ff58c7555e (patch) | |
tree | 70d5a23285ebcb0f643ca91f9ff20fc18cc22e9d | |
parent | bba3f0a308cceb56bad4aa1efe13927360ae463f (diff) | |
parent | d6ac762bf7dcc844db28dcc2f2864d8cebbb5cf6 (diff) |
Merge pull request #2412 from dingxiangfei2009/patch-repl-autoargs
nix repl respects --arg and --argstr
-rw-r--r-- | src/nix/repl.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc index b71e6f905f23..1bbe256b2d8b 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -31,6 +31,7 @@ struct NixRepl { string curDir; EvalState state; + Bindings * autoArgs; Strings loadedFiles; @@ -446,8 +447,7 @@ void NixRepl::loadFile(const Path & path) loadedFiles.push_back(path); Value v, v2; state.evalFile(lookupFileArg(state, path), v); - Bindings & bindings(*state.allocBindings(0)); - state.autoCallFunction(bindings, v, v2); + state.autoCallFunction(*autoArgs, v, v2); addAttrsToScope(v2); } @@ -699,6 +699,7 @@ struct CmdRepl : StoreCommand, MixEvalArgs void run(ref<Store> store) override { auto repl = std::make_unique<NixRepl>(searchPath, openStore()); + repl->autoArgs = getAutoArgs(repl->state); repl->mainLoop(files); } }; |