about summary refs log tree commit diff
path: root/nix-repl.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-28T09·40+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-28T09·42+0100
commit3beb6f6e763f56d791db0a99baf285e0ba745bc8 (patch)
tree3d678dcc4c16ea31bc7709f21b5324b86a4c3dfe /nix-repl.cc
parent81d658fe4afda234028cd4551e12491db4303957 (diff)
Show derivations more concisely
Diffstat (limited to 'nix-repl.cc')
-rw-r--r--nix-repl.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/nix-repl.cc b/nix-repl.cc
index 98d27b435ef2..78be0f98c426 100644
--- a/nix-repl.cc
+++ b/nix-repl.cc
@@ -489,10 +489,18 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
         seen.insert(&v);
 
         bool isDrv = state.isDerivation(v);
-        if (isDrv) str << "(derivation ";
-        str << "{ ";
 
-        if (maxDepth > 0) {
+        if (isDrv) {
+            str << "«derivation ";
+            Bindings::iterator i = v.attrs->find(state.sDrvPath);
+            PathSet context;
+            Path drvPath = i != v.attrs->end() ? state.coerceToPath(*i->value, context) : "???";
+            str << drvPath << "»";
+        }
+
+        else if (maxDepth > 0) {
+            str << "{ ";
+
             typedef std::map<string, Value *> Sorted;
             Sorted sorted;
             foreach (Bindings::iterator, i, *v.attrs)
@@ -528,11 +536,10 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
                 str << "; ";
             }
 
+            str << "}";
         } else
-            str << "... ";
+            str << "{ ... }";
 
-        str << "}";
-        if (isDrv) str << ")";
         break;
     }