1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Homogenize rails help output

In commit 6567464bed we homogenized rails
commands with former rake tasks. We decided to display all commands at
the same level and merged the list of commands displayed by `rails help`.

We however forgot to actually merge the output in the command itself.
This commit fixes that.
This commit is contained in:
Alberto Almagro 2018-10-05 00:55:57 +02:00
parent 41e47f5155
commit f553be8908

View file

@ -83,20 +83,21 @@ module Rails
end
def print_commands # :nodoc:
sorted_groups.each { |b, n| print_list(b, n) }
end
def sorted_groups # :nodoc:
lookup!
groups = (subclasses - hidden_commands).group_by { |c| c.namespace.split(":").first }
groups.transform_values! { |commands| commands.flat_map(&:printing_commands).sort }
rails = groups.delete("rails")
[[ "rails", rails ]] + groups.sort.to_a
commands.each { |command| puts(" #{command}") }
end
private
COMMANDS_IN_USAGE = %w(generate console server test test:system dbconsole new)
private_constant :COMMANDS_IN_USAGE
def commands
lookup!
visible_commands = (subclasses - hidden_commands).flat_map(&:printing_commands)
(visible_commands - COMMANDS_IN_USAGE).sort
end
def command_type # :doc:
@command_type ||= "command"
end