Skip to content
Snippets Groups Projects
Unverified Commit 16e02875 authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

nix eval: Take only one argument

Thus --json no longer produces a list.
parent cfeff3b2
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
using namespace nix; using namespace nix;
struct CmdEval : MixJSON, InstallablesCommand struct CmdEval : MixJSON, InstallableCommand
{ {
bool raw = false; bool raw = false;
...@@ -56,20 +56,16 @@ struct CmdEval : MixJSON, InstallablesCommand ...@@ -56,20 +56,16 @@ struct CmdEval : MixJSON, InstallablesCommand
auto state = getEvalState(); auto state = getEvalState();
auto jsonOut = json ? std::make_unique<JSONList>(std::cout) : nullptr; auto v = installable->toValue(*state);
PathSet context;
for (auto & i : installables) { if (raw) {
auto v = i->toValue(*state); std::cout << state->coerceToString(noPos, *v, context);
PathSet context; } else if (json) {
if (raw) { JSONPlaceholder jsonOut(std::cout);
std::cout << state->coerceToString(noPos, *v, context); printValueAsJSON(*state, true, *v, jsonOut, context);
} else if (json) { } else {
auto jsonElem = jsonOut->placeholder(); state->forceValueDeep(*v);
printValueAsJSON(*state, true, *v, jsonElem, context); std::cout << *v << "\n";
} else {
state->forceValueDeep(*v);
std::cout << *v << "\n";
}
} }
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment