diff options
Diffstat (limited to 'railties/lib/rails/command.rb')
-rw-r--r-- | railties/lib/rails/command.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/railties/lib/rails/command.rb b/railties/lib/rails/command.rb index 6d99ac9936..f09aa3ae0d 100644 --- a/railties/lib/rails/command.rb +++ b/railties/lib/rails/command.rb @@ -83,20 +83,21 @@ module Rails 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 |