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
1 changed files with 8 additions and 9 deletions

View File

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