-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ext: Replace terminal_size with comfy-table #940
Conversation
4ac0fdf
to
9692f97
Compare
Trying to test this PR, I built it into a bootc image,
Why is this pointing at |
That's exactly it - right now rpm-ostree is vendoring the ostree-ext code in Fedora. The recent merge here will let us switch that over to bootc (and we'll make rpm-ostree hard If you want to test this you'll need to explicitly take over the symlink, via |
Hmm though actually in our own CI jobs we should start taking over the hooks now. I'll do a PR for that |
The |
I'm not getting the extra newlines here...I did sanity check this too before pushing |
Seems like it only happens if the terminal is smaller than the largest line size.mp4EDIT: jinx |
Ahh wait I do get the newlines if one of the output lines is long enough to wrap past the terminal size. I think this may be fixable with https://docs.rs/comfy-table/latest/comfy_table/enum.ContentArrangement.html ? |
Yeah use comfy_table::{presets::NOTHING, Table};
fn main() {
let mut table = Table::new();
table
.load_preset(NOTHING)
.set_header(vec!["REPOSITORY", "TYPE"])
.set_content_arrangement(comfy_table::ContentArrangement::Dynamic);
table.add_row(vec!["foo", "bar"]);
table.add_row(vec![
"fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
"baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar",
]);
println!("{table}");
} Seems well behaved |
use std::env::args;
use comfy_table::{presets::NOTHING, Table};
fn main() {
let mut table = Table::new();
table
.load_preset(NOTHING)
.set_header(vec!["REPOSITORY", "TYPE"])
.set_content_arrangement(match args().nth(1).as_deref() {
Some("d") => comfy_table::ContentArrangement::Disabled,
Some("dyn") => comfy_table::ContentArrangement::Dynamic,
_ => comfy_table::ContentArrangement::DynamicFullWidth,
});
table.add_row(vec!["foo", "bar"]);
table.add_row(vec![
"fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
"baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar",
]);
println!("{table}");
} Not sure I understand the difference between |
I was looking at our vendoring set and while it's not actually relevant I found myself wondering why we had *three* versions of `windows-sys`. Having that many crate versions is often a signal that there's an unmaintained dependency. And indeed, `terminal_size` is no longer cool. The "in" crowd has moved on to newer, hipper things. Life moves fast, we need to keep up. (OK but yes also this drops some manual column printing code we had which is also a win) Signed-off-by: Colin Walters <walters@verbum.org>
403ffd3
to
32af54d
Compare
I was looking at our vendoring set and while it's not actually relevant I found myself wondering why we had three versions of
windows-sys
. Having that many crate versions is often a signal that there's an unmaintained dependency.And indeed,
terminal_size
is no longer cool. The "in" crowd has moved on to newer, hipper things. Life moves fast, we need to keep up.(OK but yes also this drops some manual column printing code
we had which is also a win)