diff options
| author | Xu Cheng | 2016-04-12 14:36:15 +0800 | 
|---|---|---|
| committer | Xu Cheng | 2016-04-12 17:57:18 +0800 | 
| commit | c1427fd295d63d141acadd03e41c5c73fb11212a (patch) | |
| tree | fca81e987209d8c6b53995a1f95d97172b70f3bb /Library/Homebrew/cmd/help.rb | |
| parent | af1eb007e2cb251692fed609b517e6aba987119d (diff) | |
| download | brew-c1427fd295d63d141acadd03e41c5c73fb11212a.tar.bz2 | |
help: support highlighted output
Closes #68.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/cmd/help.rb')
| -rw-r--r-- | Library/Homebrew/cmd/help.rb | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index 449d44d46..77b562745 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -56,7 +56,10 @@ module Homebrew      cmd_path.read.        split("\n").        grep(/^#:/). -      map { |line| line.slice(2..-1).delete("`").sub(/^  \* /, "brew ") }. -      join("\n") +      map do |line| +        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 | 
