Skip to content
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

Better programmatic use of prettytable #16

Closed
asomers opened this issue Sep 9, 2023 · 2 comments
Closed

Better programmatic use of prettytable #16

asomers opened this issue Sep 9, 2023 · 2 comments

Comments

@asomers
Copy link
Contributor

asomers commented Sep 9, 2023

Thank you so much for this crate! It's just what I need. It could be even better, though. The prettytable method looks like it's written solely with the CLI in mind, which makes it hard to use programmatically. Would it be possible:

  • Allow printing to stderr or to a string instead of only stdout.
  • Suppress line numbers.
  • Show a few lines of context beside the mismatched lines

If prettytable could do those things, then it would be perfect for my application. Which is, I want to print differences between large binary buffers in hex, as part of a test suite. First I format each buffer into hex, then use prettydiff to show the differences. I don't need line numbers because those are included in the hexdump. I do need to print to stderr instead of stdout, and some context would ease understanding. This is what it looks like right now:
Screenshot_2023-09-09_09-59-16

@romankoblov
Copy link
Collaborator

written solely with the CLI in mind

Nope, it was done to be used as library, table is printed by this function, but you can format it yourself any way you want. CLI support was just nice to have feature.

  • Suppress line numbers.

This one should be possible by set_show_lines(false) on LineChangeset before prettytable call.

Would it be possible:

  • Allow printing to stderr or to a string instead of only stdout.
  • Suppress line numbers.
  • Show a few lines of context beside the mismatched lines

I personally don't need these features, but if you send PR I will merge it.

@oli-obk
Copy link
Owner

oli-obk commented May 22, 2024

This was resolved by #17 afaict

@oli-obk oli-obk closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants