-
Notifications
You must be signed in to change notification settings - Fork 74
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
output of a table to a string with styles -- is it possible? #141
Comments
@faried I just use
|
No, I didn't find a solution. The package's internals need to be modified to support this. |
Feel free to send a PR, p.s. it's now 0.10 |
I was going to experiment with using the
This throws an error for
Not 100% sure how to capture the input back from the Terminal either, but getting this to work seems like the first step |
This seems to work for capturing the output in to a string: let temp_cursor = Cursor::new(Vec::new());
let temp_term = term::terminfo::TerminfoTerminal::new(temp_cursor);
let mut temp_term = temp_term.unwrap();
let _ = table.print_term(&mut temp_term);
// now get cursor, then get vector
let vector = temp_term.get_mut().get_ref();
let mystr = str::from_utf8(&vector).unwrap();
println!("{}", mystr);
println!("----"); |
I have a
Vec<String>
that represents my output lines. I want to append a table to it but I can't seem to do that and preserve cell styles. I've triedI'm new to Rust, so I don't know if there's a way to do this (prettytable-rs 0.8.0).
The text was updated successfully, but these errors were encountered: