nix-instantiate --eval-only --read-write-mode: Don't depend on ordering

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2014-02-04 10:37:10 -05:00 committed by Eelco Dolstra
parent e4058fab64
commit 84a8b5e9af

View file

@ -97,23 +97,19 @@ void run(Strings args)
bool strict = false; bool strict = false;
Strings attrPaths; Strings attrPaths;
Bindings autoArgs; Bindings autoArgs;
bool wantsReadWrite = false;
for (Strings::iterator i = args.begin(); i != args.end(); ) { for (Strings::iterator i = args.begin(); i != args.end(); ) {
string arg = *i++; string arg = *i++;
if (arg == "-") if (arg == "-")
readStdin = true; readStdin = true;
else if (arg == "--eval-only") { else if (arg == "--eval-only")
settings.readOnlyMode = true;
evalOnly = true; evalOnly = true;
} else if (arg == "--read-write-mode")
else if (arg == "--read-write-mode") { wantsReadWrite = true;
settings.readOnlyMode = false; else if (arg == "--parse-only")
}
else if (arg == "--parse-only") {
settings.readOnlyMode = true;
parseOnly = evalOnly = true; parseOnly = evalOnly = true;
}
else if (arg == "--find-file") else if (arg == "--find-file")
findFile = true; findFile = true;
else if (arg == "--attr" || arg == "-A") { else if (arg == "--attr" || arg == "-A") {
@ -146,6 +142,9 @@ void run(Strings args)
files.push_back(arg); files.push_back(arg);
} }
if (evalOnly && !wantsReadWrite)
settings.readOnlyMode = true;
if (attrPaths.empty()) attrPaths.push_back(""); if (attrPaths.empty()) attrPaths.push_back("");
if (findFile) { if (findFile) {