dev-cmd/contributions: improve CSV output.
Output messages to stderr when CSV output is enabled. This allows doing `brew contributions --csv > contributions.csv` to save the output to a file.
This commit is contained in:
		
							parent
							
								
									144113318e
								
							
						
					
					
						commit
						8d4395118c
					
				@ -88,16 +88,21 @@ module Homebrew
 | 
				
			|||||||
          contributions <<
 | 
					          contributions <<
 | 
				
			||||||
            "#{Utils.pluralize("time", grand_totals[username].values.sum, include_count: true)} (total)"
 | 
					            "#{Utils.pluralize("time", grand_totals[username].values.sum, include_count: true)} (total)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          puts [
 | 
					          contributions_string = [
 | 
				
			||||||
            "#{username} contributed",
 | 
					            "#{username} contributed",
 | 
				
			||||||
            *contributions.to_sentence,
 | 
					            *contributions.to_sentence,
 | 
				
			||||||
            "#{time_period(from:, to: args.to)}.",
 | 
					            "#{time_period(from:, to: args.to)}.",
 | 
				
			||||||
          ].join(" ")
 | 
					          ].join(" ")
 | 
				
			||||||
 | 
					          if args.csv?
 | 
				
			||||||
 | 
					            $stderr.puts contributions_string
 | 
				
			||||||
 | 
					          else
 | 
				
			||||||
 | 
					            puts contributions_string
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return unless args.csv?
 | 
					        return unless args.csv?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        puts
 | 
					        $stderr.puts
 | 
				
			||||||
        puts generate_csv(grand_totals)
 | 
					        puts generate_csv(grand_totals)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user