Method: Command::CommandBase.help

Defined in:
lib/commandbase.rb

.helpObject

ヘルプを見やすく色付け



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/commandbase.rb', line 20

def @opt.help
  msg = super
  # 見出し部分
  msg.gsub!(/((?:Examples|Options|Configuration|[^\s]+? Variable List):)/) do
    "<underline><bold>#{$1}</bold></underline>".termcolor
  end
  # Examples のコメント部分
  msg.gsub!(/(#.+)$/) do
    "<cyan>#{TermColorLight.escape($1)}</cyan>".termcolor
  end
  # 文字列部分
  msg.gsub!(/(".+?")/) do
    "<yellow>#{TermColorLight.escape($1)}</yellow>".termcolor
  end
  msg
end