Skip to content

Commit

Permalink
Support -I flag
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Aug 26, 2014
1 parent 89f9c0d commit 71d6150
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions nix-repl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(".");
Expand Down Expand Up @@ -595,19 +595,21 @@ 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
files.push_back(*arg);
return true;
});

NixRepl repl;
NixRepl repl(searchPath);
repl.mainLoop(files);
});
}

0 comments on commit 71d6150

Please sign in to comment.