diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-02-28 18:34:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-28 18:34:00 -0500 |
commit | c9fa561b2e8dd6bfe31c1850a47e2f17cac94aa6 (patch) | |
tree | 5d21cc59edd9dd6cdad5f756a797e368983e747d /railties/lib | |
parent | f008562dd35b0981732a69f1002eadb12850c1b2 (diff) | |
parent | c6d928f3cae28e3b531d3cc4bcde2ddca0323f11 (diff) | |
download | rails-c9fa561b2e8dd6bfe31c1850a47e2f17cac94aa6.tar.gz rails-c9fa561b2e8dd6bfe31c1850a47e2f17cac94aa6.tar.bz2 rails-c9fa561b2e8dd6bfe31c1850a47e2f17cac94aa6.zip |
Merge pull request #32130 from benoittgt/rake-routes-compact-mode
Add "rails routes --expanded" mode
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/commands/routes/routes_command.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/railties/lib/rails/commands/routes/routes_command.rb b/railties/lib/rails/commands/routes/routes_command.rb index c4fd6c7eb5..c4f3717095 100644 --- a/railties/lib/rails/commands/routes/routes_command.rb +++ b/railties/lib/rails/commands/routes/routes_command.rb @@ -7,12 +7,14 @@ module Rails class RoutesCommand < Base # :nodoc: class_option :controller, aliases: "-c", type: :string, desc: "Specifies the controller." class_option :grep_pattern, aliases: "-g", type: :string, desc: "Specifies grep pattern." + class_option :expanded_format, aliases: "--expanded", type: :string, desc: "Turn on expanded format mode." no_commands do def help say "Usage: Print out all defined routes in match order, with names." say "" say "Target specific controller with -c option, or grep routes using -g option" + say "Use expanded format with --expanded option" say "" end end @@ -24,7 +26,11 @@ module Rails all_routes = Rails.application.routes.routes inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes) - say inspector.format(ActionDispatch::Routing::ConsoleFormatter.new, routes_filter) + if options.has_key?("expanded_format") + say inspector.format(ActionDispatch::Routing::ConsoleFormatter::Expanded.new, routes_filter) + else + say inspector.format(ActionDispatch::Routing::ConsoleFormatter::Sheet.new, routes_filter) + end end private |