From 4305443c9c5a83815794d1b1610b128b33d4eb22 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Tue, 4 Apr 2023 22:50:40 +0800 Subject: [PATCH] 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 --- Library/Homebrew/commands.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 8eccbb1c86..fd6a39fcf2 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -203,6 +203,10 @@ module Commands if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(path)) 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 else cmd_parser.description