Conversation
There was a problem hiding this comment.
i like the idea of supporting this sort of thing, but this example doesnt seem to work very well
#!/usr/bin/env ruby
# typed: true
require('cli/ui')
CLI::UI.frame_style = :bracket
CLI::UI::StdoutRouter.enable
CLI::UI::Frame.open('Frame 2') do
30.times do
CLI::UI.write('test')
end
end
CLI::UI::Frame.open('Frame 3') do
CLI::UI.write('test' * 20)
end
CLI::UI::Frame.open('Frame 4') do
CLI::UI.write('test' * 30)
CLI::UI.write("\n")
endi guess i'd expect closing out the frame to inject a newline? not sure.. we've kind of avoided this up until now because of these sorts of problems. i haven't looked at how easy that would be to do. you could consider doing this manually via CLI::UI.raw e.g.
CLI::UI::Frame.open('Frame 1') do
CLI::UI::Frame.open('Frame 2') do
CLI::UI.raw do
$stdout.write(CLI::UI::Frame.prefix)
$stdout.write('test' * 30)
$stdout.write("\n")
end
end
endand then it's the responsibility of the caller to ensure there's a trailing newline. if we provided something like CLI::UI.write ourselves i think it's our responsibility to ensure frames work sanely. maybe it'd make sense to have some api that automatically adds the newline at the end of the block? e.g.
CLI::UI.write_line do |io|
io.write('test' * 30)
end
the ruby + gem version bumps i think are unrelated to this change and should be split out if this pr continues
|
Thanks for the tips @joshheinrichs-shopify I'll PM you more details since this repo is public. |


Helps when writing in a frame.
Examples:

It's helpful because existing methods to write don't work well in frames because the beginning bar is missing. This still isn't great, but it's much better:

Bump to version
2.4.0.Bump Ruby version to 3.3.1.