Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 2 additions & 6 deletions lib/hanami/cli/commands/app/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading