mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
nix eval: Take only one argument
Thus --json no longer produces a list.
This commit is contained in:
parent
cfeff3b273
commit
16e0287556
1 changed files with 11 additions and 15 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
using namespace nix;
|
||||
|
||||
struct CmdEval : MixJSON, InstallablesCommand
|
||||
struct CmdEval : MixJSON, InstallableCommand
|
||||
{
|
||||
bool raw = false;
|
||||
|
||||
|
@ -56,20 +56,16 @@ 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);
|
||||
PathSet context;
|
||||
if (raw) {
|
||||
std::cout << state->coerceToString(noPos, *v, context);
|
||||
} else if (json) {
|
||||
auto jsonElem = jsonOut->placeholder();
|
||||
printValueAsJSON(*state, true, *v, jsonElem, context);
|
||||
} else {
|
||||
state->forceValueDeep(*v);
|
||||
std::cout << *v << "\n";
|
||||
}
|
||||
auto v = installable->toValue(*state);
|
||||
PathSet context;
|
||||
if (raw) {
|
||||
std::cout << state->coerceToString(noPos, *v, context);
|
||||
} else if (json) {
|
||||
JSONPlaceholder jsonOut(std::cout);
|
||||
printValueAsJSON(*state, true, *v, jsonOut, context);
|
||||
} else {
|
||||
state->forceValueDeep(*v);
|
||||
std::cout << *v << "\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue