aboutsummaryrefslogtreecommitdiff
path: root/src/nix/eval.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/eval.cc')
-rw-r--r--src/nix/eval.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/nix/eval.cc b/src/nix/eval.cc
index 0fbeca1c1..b7058361c 100644
--- a/src/nix/eval.cc
+++ b/src/nix/eval.cc
@@ -5,10 +5,11 @@
#include "eval.hh"
#include "json.hh"
#include "value-to-json.hh"
+#include "progress-bar.hh"
using namespace nix;
-struct CmdEval : MixJSON, InstallablesCommand
+struct CmdEval : MixJSON, InstallableCommand
{
bool raw = false;
@@ -56,20 +57,19 @@ struct CmdEval : MixJSON, InstallablesCommand
auto state = getEvalState();
- auto jsonOut = json ? std::make_unique<JSONList>(std::cout) : nullptr;
+ auto v = installable->toValue(*state);
+ PathSet context;
- 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";
- }
+ stopProgressBar();
+
+ 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";
}
}
};