Closed dtolnay closed 5 years ago
tabwriter
is a minimal thing you can use to get alignment with tab separated fields. It does not do ASCII art or pagination though.
There is prettytable-rs. But it's pretty simple.
Thanks, prettytable-rs looks pretty close to what I want. I like the subtle unicode line art that bat
uses. Is that doable as a prettytable format?
I newer used it. I wanted to use it in cargo-bloat
, but it doesn't support column width, which I need.
Does it makes sense to use another 2-dimensional data structure instead of Vec<Vec<String>>
? I'm experimenting with a Grid<T>
type backed by a single Vec<T>
.
Also, tabular-rs
supports right- and left-aligning.
prettytable-rs
can print bat
like lines.
Thanks all! I have removed this idea from my list since it is easily solved by using the prettytable-rs
crate + pager
crate which already existed when I opened this issue.
In
cargo llvm-lines
the program output is a table with two columns of numbers and one column of strings. I would like a super easy way to make such output look good with the minimal amount of work in my crate. Something like:which takes care of aligning the data (right aligned for columns of numbers, left aligned for text), drawing ASCII art to make it pretty (like what
bat
does), and invoking the default system pager to support paging the output up and down (again similar tobat
).If the output is not a tty, the paging and ASCII art should be disabled automatically.