commands: explain change in command description splitting
A comment here would help the reader to understand the need for this splitting logic, which is not so straightforward. Addresses review comment in https://github.com/Homebrew/brew/pull/15146#discussion_r1157361656. Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
This commit is contained in:
parent
0048a86673
commit
4305443c9c
@ -203,6 +203,10 @@ module Commands
|
|||||||
|
|
||||||
if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(path))
|
if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(path))
|
||||||
if short
|
if short
|
||||||
|
# We only consider a dot as a full stop if it is either followed by a
|
||||||
|
# whitespace or at the end of the description. In this way we can
|
||||||
|
# prevent cutting off a sentence in the middle due to dots in URLs or
|
||||||
|
# paths.
|
||||||
cmd_parser.description.split(/\.(?>\s|$)/).first
|
cmd_parser.description.split(/\.(?>\s|$)/).first
|
||||||
else
|
else
|
||||||
cmd_parser.description
|
cmd_parser.description
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user