diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 17b21cdca7..844bc9130c 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -28,13 +28,13 @@ module Homebrew @constraints = [] @conflicts = [] @processed_options = [] - @desc_line_length = 48 + @desc_line_length = 43 instance_eval(&block) post_initialize end def post_initialize - @parser.on_tail("-h", "--help", "Show this message") do + @parser.on_tail("-h", "--help", "Show this message.") do puts generate_help_text exit 0 end @@ -127,9 +127,10 @@ module Homebrew def generate_help_text @parser.to_s.sub(/^/, "#{Tty.bold}Usage: brew#{Tty.reset} ") - .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") + .gsub(/`(.*?)`/m, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } - .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") + .gsub(/<(.*?)>/m, "#{Tty.underline}\\1#{Tty.reset}") + .gsub(/\*(.*?)\*/m, "#{Tty.underline}\\1#{Tty.reset}") end private diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index d541081c8d..671a962afc 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -93,6 +93,7 @@ module Homebrew .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") + .gsub(/\*(.*?)\*/, "#{Tty.underline}\\1#{Tty.reset}") .gsub("@hide_from_man_page", "") end.join.strip end diff --git a/Library/Homebrew/test/cli_parser_spec.rb b/Library/Homebrew/test/cli_parser_spec.rb index ba1f8c4ae8..a2f294e78e 100644 --- a/Library/Homebrew/test/cli_parser_spec.rb +++ b/Library/Homebrew/test/cli_parser_spec.rb @@ -89,6 +89,7 @@ describe Homebrew::CLI::Parser do it "raises exception on depends_on constraint violation" do expect { parser.parse(["--flag2=flag2"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) + expect { parser.parse(["--flag4=flag4"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) end it "raises exception for conflict violation" do @@ -139,6 +140,7 @@ describe Homebrew::CLI::Parser do it "raises exception on depends_on constraint violation" do expect { parser.parse(["--switch-c"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) + expect { parser.parse(["--switch-d"]) }.to raise_error(Homebrew::CLI::OptionConstraintError) end it "raises exception for conflict violation" do