forked from lix-project/lix
Support -I flag
This commit is contained in:
parent
89f9c0d41b
commit
71d61508f2
12
nix-repl.cc
12
nix-repl.cc
|
@ -38,7 +38,7 @@ struct NixRepl
|
||||||
StringSet completions;
|
StringSet completions;
|
||||||
StringSet::iterator curCompletion;
|
StringSet::iterator curCompletion;
|
||||||
|
|
||||||
NixRepl();
|
NixRepl(const Strings & searchPath);
|
||||||
void mainLoop(const Strings & files);
|
void mainLoop(const Strings & files);
|
||||||
void completePrefix(string prefix);
|
void completePrefix(string prefix);
|
||||||
bool getLine(string & line);
|
bool getLine(string & line);
|
||||||
|
@ -72,8 +72,8 @@ string removeWhitespace(string s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NixRepl::NixRepl()
|
NixRepl::NixRepl(const Strings & searchPath)
|
||||||
: state(Strings())
|
: state(searchPath)
|
||||||
, staticEnv(false, &state.staticBaseEnv)
|
, staticEnv(false, &state.staticBaseEnv)
|
||||||
{
|
{
|
||||||
curDir = absPath(".");
|
curDir = absPath(".");
|
||||||
|
@ -595,11 +595,13 @@ int main(int argc, char * * argv)
|
||||||
return handleExceptions(argv[0], [&]() {
|
return handleExceptions(argv[0], [&]() {
|
||||||
initNix();
|
initNix();
|
||||||
|
|
||||||
Strings files;
|
Strings files, searchPath;
|
||||||
|
|
||||||
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
|
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
|
||||||
if (*arg == "--version")
|
if (*arg == "--version")
|
||||||
printVersion("nix-repl");
|
printVersion("nix-repl");
|
||||||
|
else if (parseSearchPathArg(arg, end, searchPath))
|
||||||
|
;
|
||||||
else if (*arg != "" && arg->at(0) == '-')
|
else if (*arg != "" && arg->at(0) == '-')
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
@ -607,7 +609,7 @@ int main(int argc, char * * argv)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
NixRepl repl;
|
NixRepl repl(searchPath);
|
||||||
repl.mainLoop(files);
|
repl.mainLoop(files);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue