nix eval: Take only one argument

Thus --json no longer produces a list.
This commit is contained in:
Eelco Dolstra 2018-01-17 12:03:06 +01:00
parent cfeff3b273
commit 16e0287556
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -8,7 +8,7 @@
using namespace nix;
struct CmdEval : MixJSON, InstallablesCommand
struct CmdEval : MixJSON, InstallableCommand
{
bool raw = false;
@ -56,22 +56,18 @@ struct CmdEval : MixJSON, InstallablesCommand
auto state = getEvalState();
auto jsonOut = json ? std::make_unique<JSONList>(std::cout) : nullptr;
for (auto & i : installables) {
auto v = i->toValue(*state);
auto v = installable->toValue(*state);
PathSet context;
if (raw) {
std::cout << state->coerceToString(noPos, *v, context);
} else if (json) {
auto jsonElem = jsonOut->placeholder();
printValueAsJSON(*state, true, *v, jsonElem, context);
JSONPlaceholder jsonOut(std::cout);
printValueAsJSON(*state, true, *v, jsonOut, context);
} else {
state->forceValueDeep(*v);
std::cout << *v << "\n";
}
}
}
};
static RegisterCommand r1(make_ref<CmdEval>());