man: parse short and long options in shell commands

Add a regex to handle two comma-separated options on the same line in
command help strings.
This commit is contained in:
Mike Miller 2019-02-12 16:50:13 -08:00
parent db42dd0420
commit a4c8fc74f7

View File

@ -195,7 +195,9 @@ module Homebrew
line = line.slice(4..-1)
next unless line
lines << line.gsub(/^ +(-+[a-z-]+) */, "* `\\1`:\n ")
# Format one option or a comma-separated pair of short and long options.
lines << line.gsub(/^ +(-+[a-z-]+), (-+[a-z-]+) +/, "* `\\1`, `\\2`:\n ")
.gsub(/^ +(-+[a-z-]+) +/, "* `\\1`:\n ")
end
lines
end