Color output #4

Merged
Sven merged 8 commits from colors into main 2022-05-29 07:31:37 +00:00
3 changed files with 5 additions and 5 deletions
Showing only changes of commit b8b7cc8d12 - Show all commits

View file

@ -57,7 +57,7 @@ parser = OptionParser.new do |opt|
puts FormatStaged::VERSION
exit
end
opt.on('--[no-]color', 'Colorizes output') do |value|
parameters[:color_output] = value
end

View file

@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.homepage = 'https://github.com/5sw/format-staged'
s.license = 'MIT'
s.required_ruby_version = '~> 2.7'
s.add_dependency 'colorize'
s.add_development_dependency 'rake', '~> 13.0'

View file

@ -31,15 +31,15 @@ class FormatStaged
[pid, r]
end
def read_output(r, lines: true, silent: false)
result = r.read
def read_output(output, lines: true, silent: false)
result = output.read
splits = result.split("\n")
if @verbose && !silent
splits.each do |line|
puts "< #{line}"
end
end
r.close
output.close
lines ? splits : result
end