commands: Use a hash instead of nested arrays

This commit is contained in:
William Ma 2020-07-23 12:23:36 -04:00
parent de4f5c1095
commit 33f1c3164b

View File

@ -31,18 +31,20 @@ module Homebrew
return
end
first = true
prepend_separator = false
[["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]]
{ "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
next if commands.blank?
puts if prepend_separator
ohai title, Formatter.columns(commands)
end
prepend_separator = true
end
end
end