How to get the raw `tsv` format without any alignment/padding ?
wjwei-handsome opened this issue · 2 comments
wjwei-handsome commented
As the title described, I want to output a raw tsv
style as the input for downstream process(such as cut -f 1
)
So if there is a preset style for raw tsv
style?
If not, how to custom such a style?
Thanks!
Best wishes.
zhiburt commented
There's no such style as it's not exactly a style; (it's a good example of a theme
rather than a style #126)
But you surely can do a custom one to achieve it.
Try something like this and let me know if it helps.
use tabled::{
settings::{Alignment, Padding, Style},
Table,
};
fn main() {
let themes = ["tsv", "csv"];
let data = themes.iter().enumerate();
let mut table = Table::new(data);
table
.with(Style::empty().vertical('\t'))
.with(Alignment::left())
.with(Padding::zero());
println!("{table}");
}
wjwei-handsome commented
Thanks for your lightning response!
This demo works well for me
Thanks again for such a excellent crate :)