aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/routes/routes_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/commands/routes/routes_command.rb')
-rw-r--r--railties/lib/rails/commands/routes/routes_command.rb8
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