diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-08-26T18·05+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-08-26T18·05+0200 |
commit | 71d61508f203e8d926a0365332ff218c1314f734 (patch) | |
tree | 44f2d8cecd97f019af036da9d2fac99e9d3cfcc8 /nix-repl.cc | |
parent | 89f9c0d41b29d18e2804677da856e84c86c83b45 (diff) |
Support -I flag
Diffstat (limited to 'nix-repl.cc')
-rw-r--r-- | nix-repl.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/nix-repl.cc b/nix-repl.cc index bff54aa14f3a..51d297d1d175 100644 --- a/nix-repl.cc +++ b/nix-repl.cc @@ -38,7 +38,7 @@ struct NixRepl StringSet completions; StringSet::iterator curCompletion; - NixRepl(); + NixRepl(const Strings & searchPath); void mainLoop(const Strings & files); void completePrefix(string prefix); bool getLine(string & line); @@ -72,8 +72,8 @@ string removeWhitespace(string s) } -NixRepl::NixRepl() - : state(Strings()) +NixRepl::NixRepl(const Strings & searchPath) + : state(searchPath) , staticEnv(false, &state.staticBaseEnv) { curDir = absPath("."); @@ -595,11 +595,13 @@ int main(int argc, char * * argv) return handleExceptions(argv[0], [&]() { initNix(); - Strings files; + Strings files, searchPath; parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) { if (*arg == "--version") printVersion("nix-repl"); + else if (parseSearchPathArg(arg, end, searchPath)) + ; else if (*arg != "" && arg->at(0) == '-') return false; else @@ -607,7 +609,7 @@ int main(int argc, char * * argv) return true; }); - NixRepl repl; + NixRepl repl(searchPath); repl.mainLoop(files); }); } |