From 7fb425a5c6bbd8195fc124473bb3d826ff6b5a04 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Mon, 15 Oct 2018 14:55:58 -0400 Subject: [PATCH] man.rb: avoid showing comma when an option has no long version. Specifically, `brew ruby -e ""`. --- Library/Homebrew/dev-cmd/man.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 5a906d7c4a..4896bcd33a 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -223,15 +223,16 @@ module Homebrew end 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 def format_short_opt(opt) - "`#{opt}`, " unless opt.nil? + "`#{opt}`" unless opt.nil? end def format_long_opt(opt) - "`#{opt}`" + "`#{opt}`" unless opt.nil? end def format_usage_banner(usage_banner)