diff --git a/CHANGELOG.md b/CHANGELOG.md index 834950a3..3be8f34d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve - `Hanami::CLI::SystemCall::Result#out` and `#err` are now `#stdout` and `#stderr`. These return strings of the captured output, or `nil` when output was written to a given stream instead. (@timriley) - App commands now receive arguments based on their `#call` params, consistent with standard Dry CLI 2.0 commands. They no longer need a `**` catch-all for params they don't use, such as `env:`, or params that other gems add to the same command. (@timriley in #460) - `Hanami::CLI::FileAlreadyExistsError` is now a `Dry::CLI::ExitError`, not a `Hanami::CLI::Error`. When this is raised through a full CLI invocation, this continues to print a message and exit with 1. Any code otherwise calling these commands directly (such as tests) now get this error raised, not a full exit. (@timriley in #461) +- `hanami routes` passes the app router's `#routes` directly to a formatter, instead of using the `Hanami::Router::Inspector` removed in hanami-router 3.1. (@timriley in #466) ### Deprecated diff --git a/lib/hanami/cli/commands/app/routes.rb b/lib/hanami/cli/commands/app/routes.rb index 2c4b86d4..2665d00f 100644 --- a/lib/hanami/cli/commands/app/routes.rb +++ b/lib/hanami/cli/commands/app/routes.rb @@ -50,11 +50,9 @@ class Routes < Hanami::CLI::Command # @since 2.0.0 # @api private def call(format: DEFAULT_FORMAT, **) - require "hanami/router/inspector" require "hanami/prepare" - inspector = Hanami::Router::Inspector.new(formatter: resolve_formatter(format)) - app.router(inspector: inspector) - puts inspector.call + routes = app.router.routes + puts resolve_formatter(format).call(routes) end private @@ -70,10 +68,8 @@ def resolve_formatter(format) def resolve_formatter_from_hanami_router(format) case format when "human_friendly" - require "hanami/router/formatter/human_friendly" Hanami::Router::Formatter::HumanFriendly.new when "csv" - require "hanami/router/formatter/csv" Hanami::Router::Formatter::CSV.new end end