Skip to content

Commit

Permalink
feat: Use color when piping to less
Browse files Browse the repository at this point in the history
  • Loading branch information
pusewicz committed Mar 29, 2024
1 parent 0909cf5 commit 65edc77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/vimpk/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def update_command
puts
puts "Displaying diffs…"

IO.popen("less", "w") do |io|
options = ENV["NO_COLOR"] ? [] : %w[--use-color -R]

IO.popen(["less", *options], "w") do |io|
statuses.each do |basename, status|
status.lines.each do |line|
io.puts "#{basename}: #{colorize_diff line}"
Expand Down

0 comments on commit 65edc77

Please sign in to comment.