Show derivations more concisely
This commit is contained in:
		
							parent
							
								
									81d658fe4a
								
							
						
					
					
						commit
						3beb6f6e76
					
				
					 1 changed files with 13 additions and 6 deletions
				
			
		
							
								
								
									
										19
									
								
								nix-repl.cc
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								nix-repl.cc
									
										
									
									
									
								
							| 
						 | 
					@ -489,10 +489,18 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
 | 
				
			||||||
        seen.insert(&v);
 | 
					        seen.insert(&v);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool isDrv = state.isDerivation(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;
 | 
					            typedef std::map<string, Value *> Sorted;
 | 
				
			||||||
            Sorted sorted;
 | 
					            Sorted sorted;
 | 
				
			||||||
            foreach (Bindings::iterator, i, *v.attrs)
 | 
					            foreach (Bindings::iterator, i, *v.attrs)
 | 
				
			||||||
| 
						 | 
					@ -528,11 +536,10 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
 | 
				
			||||||
                str << "; ";
 | 
					                str << "; ";
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            str << "}";
 | 
				
			||||||
        } else
 | 
					        } else
 | 
				
			||||||
            str << "... ";
 | 
					            str << "{ ... }";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        str << "}";
 | 
					 | 
				
			||||||
        if (isDrv) str << ")";
 | 
					 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue