aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlberto Almagro <albertoalmagro@gmail.com>2018-10-05 00:55:57 +0200
committerAlberto Almagro <albertoalmagro@gmail.com>2018-11-19 22:48:51 +0100
commitf553be8908325d54674c4989d45e8d80a89bae8f (patch)
treeaace91ce845c61135e6a07f12be4eb0bc4d6c0ef
parent41e47f5155211ff0f9bbd89fefb88546696fc3a3 (diff)
downloadrails-f553be8908325d54674c4989d45e8d80a89bae8f.tar.gz
rails-f553be8908325d54674c4989d45e8d80a89bae8f.tar.bz2
rails-f553be8908325d54674c4989d45e8d80a89bae8f.zip
Homogenize rails help output
In commit 6567464bedd1e39ee7390da9484ba0caa7eb3e07 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.
-rw-r--r--railties/lib/rails/command.rb19
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