Merge pull request #8462 from reitermarkus/refactor-utils

Move `command_help_lines` into `Help` module.
This commit is contained in:
Markus Reiter 2020-08-24 01:39:03 +02:00 committed by GitHub
commit 86bd7bddbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -104,6 +104,14 @@ module Homebrew
end
private_class_method :parser_help
def command_help_lines(path)
path.read
.lines
.grep(/^#:/)
.map { |line| line.slice(2..-1).delete_prefix(" ") }
end
private_class_method :command_help_lines
def comment_help(path)
# Otherwise read #: lines from the file.
help_lines = command_help_lines(path)

View File

@ -511,13 +511,6 @@ module Kernel
end
end
def command_help_lines(path)
path.read
.lines
.grep(/^#:/)
.map { |line| line.slice(2..-1).delete_prefix(" ") }
end
def redact_secrets(input, secrets)
secrets.compact
.reduce(input) { |str, secret| str.gsub secret, "******" }