man.rb: avoid showing comma when an option has no long version.

Specifically, `brew ruby -e "<ruby code>"`.
This commit is contained in:
EricFromCanada 2018-10-15 14:55:58 -04:00
parent 63b3d400e0
commit 7fb425a5c6

View File

@ -223,15 +223,16 @@ module Homebrew
end end
def generate_option_doc(short, long, desc) def generate_option_doc(short, long, desc)
"* #{format_short_opt(short)}#{format_long_opt(long)}:" + "\n " + desc + "\n" comma = (short && long) ? ", " : ""
"* #{format_short_opt(short)}" + comma + "#{format_long_opt(long)}:" + "\n " + desc + "\n"
end end
def format_short_opt(opt) def format_short_opt(opt)
"`#{opt}`, " unless opt.nil? "`#{opt}`" unless opt.nil?
end end
def format_long_opt(opt) def format_long_opt(opt)
"`#{opt}`" "`#{opt}`" unless opt.nil?
end end
def format_usage_banner(usage_banner) def format_usage_banner(usage_banner)