Add stderr, stdin, and stdout support for Dry::CLI#151
Add stderr, stdin, and stdout support for Dry::CLI#151aaronmallen wants to merge 1 commit intodry-rb:mainfrom
stderr, stdin, and stdout support for Dry::CLI#151Conversation
46410e6 to
ef66718
Compare
Introduce `stderr`, `stdin`, and `stdout` streams to `Dry::CLI` and its components to better handle I/O. This allows commands to utilize specific input/output streams, improving flexibility and testability. Refactor existing methods to use the new stream parameters consistently.
ef66718 to
075a7c6
Compare
|
Per my comments here (#150 (comment)), this is a change that I think is worth breaking API compatibility over, and releasing as 2.0 if needed. Why is it breaking compatibility? Previously Dry::CLI made no claim over the structure of a command's I think this is a good change because it sets the expectation with users that they should use the streams that are given to them, rather than handle IO themselves. This ensures we're using the same streams as given to This arrangement matches what we already do internally within Hanami::CLI::Command, which is our own primary in-ecosystem consumer of Dry CLI. @flash-gordon @cllns @alassek — what do you think about this? Worth the change, in your opinion? And do you actually consider it "breaking?" |
| spell_checker = SpellChecker.call(result, arguments) | ||
| err.puts spell_checker if spell_checker | ||
| stderr.puts spell_checker if spell_checker | ||
| puts |
There was a problem hiding this comment.
@timriley is this a bug? Should this be stderr.puts and if so would you like me to fix it in this PR?
Introduce
stderr,stdin, andstdoutstreams toDry::CLIand its components to better handle I/O. This allows commands to utilize specific input/output streams, improving flexibility and testability. Refactor existing methods to use the new stream parameters consistently.As an alternative to #150
cc @timriley