提交 f553be89 编写于 作者: A Alberto Almagro

Homogenize rails help output

In commit 6567464b 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.
上级 41e47f51
......@@ -83,20 +83,21 @@ def root
end
def print_commands # :nodoc:
sorted_groups.each { |b, n| print_list(b, n) }
commands.each { |command| puts(" #{command}") }
end
def sorted_groups # :nodoc:
lookup!
private
COMMANDS_IN_USAGE = %w(generate console server test test:system dbconsole new)
private_constant :COMMANDS_IN_USAGE
groups = (subclasses - hidden_commands).group_by { |c| c.namespace.split(":").first }
groups.transform_values! { |commands| commands.flat_map(&:printing_commands).sort }
def commands
lookup!
rails = groups.delete("rails")
[[ "rails", rails ]] + groups.sort.to_a
end
visible_commands = (subclasses - hidden_commands).flat_map(&:printing_commands)
(visible_commands - COMMANDS_IN_USAGE).sort
end
private
def command_type # :doc:
@command_type ||= "command"
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册