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