commands: Fix code review comments
This commit is contained in:
parent
92953aa8e8
commit
de4f5c1095
@ -31,17 +31,17 @@ module Homebrew
|
||||
return
|
||||
end
|
||||
|
||||
[["Built-in commands", -> { Commands.internal_commands }],
|
||||
["Built-in developer commands", -> { Commands.internal_developer_commands }],
|
||||
["External commands", -> { Commands.external_commands }],
|
||||
["Cask commands", -> { Commands.cask_internal_commands }],
|
||||
["External cask commands", -> { Commands.cask_external_commands }]]
|
||||
.each_with_index do |title_and_proc, index|
|
||||
title, proc = title_and_proc
|
||||
cmds = proc.call
|
||||
if cmds.present?
|
||||
puts unless index.zero?
|
||||
ohai title, Formatter.columns(cmds)
|
||||
first = true
|
||||
|
||||
[["Built-in commands", Commands.internal_commands],
|
||||
["Built-in developer commands", Commands.internal_developer_commands],
|
||||
["External commands", Commands.external_commands],
|
||||
["Cask commands", Commands.cask_internal_commands],
|
||||
["External cask commands", Commands.cask_external_commands]]
|
||||
.each do |title, commands|
|
||||
if commands.present?
|
||||
first = !first && puts
|
||||
ohai title, Formatter.columns(commands)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -155,10 +155,10 @@ module Commands
|
||||
def cask_external_commands
|
||||
PATH.new(Tap.cmd_directories, ENV["HOMEBREW_PATH"]).flat_map do |search_path|
|
||||
find_commands(search_path).map do |possible_command|
|
||||
p = possible_command.to_path
|
||||
command_name = p.match(/brewcask-(.*)\.rb/) { |data| data[1].delete_suffix(".rb") }
|
||||
path = possible_command.to_path
|
||||
command_name = path.match(/brewcask-(.*)\.rb/) { |data| data[1].delete_suffix(".rb") }
|
||||
if command_name.blank? && possible_command.executable?
|
||||
command_name = p.match(/brewcask-(.*)/) { |data| data[1] }
|
||||
command_name = path.match(/brewcask-(.*)/) { |data| data[1] }
|
||||
end
|
||||
command_name
|
||||
end.compact
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user