Move command_help_lines into Help module.

This commit is contained in:
Markus Reiter 2020-08-24 00:45:14 +02:00
parent 8e78990176
commit 0514e2dbba
2 changed files with 8 additions and 7 deletions

View File

@ -100,6 +100,14 @@ module Homebrew
cmd_parser.generate_help_text cmd_parser.generate_help_text
end end
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) def comment_help(path)
# Otherwise read #: lines from the file. # Otherwise read #: lines from the file.
help_lines = command_help_lines(path) help_lines = command_help_lines(path)

View File

@ -511,13 +511,6 @@ module Kernel
end end
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) def redact_secrets(input, secrets)
secrets.compact secrets.compact
.reduce(input) { |str, secret| str.gsub secret, "******" } .reduce(input) { |str, secret| str.gsub secret, "******" }