help: support highlighted output

Closes #68.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2016-04-12 14:36:15 +08:00
parent af1eb007e2
commit c1427fd295

View File

@ -56,7 +56,10 @@ module Homebrew
cmd_path.read. cmd_path.read.
split("\n"). split("\n").
grep(/^#:/). grep(/^#:/).
map { |line| line.slice(2..-1).delete("`").sub(/^ \* /, "brew ") }. map do |line|
join("\n") line.slice(2..-1).sub(/^ \* /, "#{Tty.highlight}brew#{Tty.reset} ").
gsub(/`(.*?)`/, "#{Tty.highlight}\\1#{Tty.reset}").
gsub(/<(.*?)>/, "#{Tty.em}\\1#{Tty.reset}")
end.join("\n")
end end
end end