phsym / prettytable-rs

A rust library to print aligned and formatted tables
https://crates.io/crates/prettytable-rs
BSD 3-Clause "New" or "Revised" License
936 stars 74 forks source link

switch for parsable output #65

Open Licenser opened 7 years ago

Licenser commented 7 years ago

Many CLI programs use -H for headerless and -p for passable when it comes to printing tables. Reading the docs, I think that could be done by specifying a custom format, but it would be helpful to have a simple switch for those options.

phsym commented 6 years ago

What about printing the table into CSV instead ?

phsym commented 6 years ago

(Sorry for the late reply by the way)

andoriyu commented 6 years ago

@phsym Well, still need to take care of header, no? That part can be handled with slices I believe.

Plus, parsable output usually tab separated to allow consumption from within shell scripts without thinking about quotes. Having to_csv_string shortcut similar to from_csv_string would be a fine addition to my collection api.

However, parsable output needed for things that usually came from the iterator, so -H can completely ignore Table and just output it itself, at least that how I've done.