Closed
Description
Describe the bug
Keyword arguments for a command aren't passed correctly to commands that use callbacks.
To Reproduce
I have two gems: hanami-cli
that depends on dry-cli
, and hanami-rspec
that depends on hanami-cli
.
The first gem (hanami-cli
) defines a command hanami generate slice NAME
, which loosely correspond to this implementation:
module Hanami
module CLI
module Generate
class Slice < Command
argument :name, required: true, desc: "The slice name"
def call(name: )
puts "generating slice: #{name}"
end
end
end
end
end
The second gem (hanami-rspec
) hooks into the invocation of hanami generate slice
with an after callback.
module Hanami
module RSpec
module Generate
class Slice < Command
def call(options, **)
puts "generating slice: #{options[:name]}"
end
end
end
end
end
Expected behavior
I would have expected that Hanami::RSpec::Generate::Slice#call
would have accepted the :name
keyword argument. What it does instead, it passes a Hash.
My environment
- Affects my production application: NO
- Ruby version: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
- OS: Darwin out.lan 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64