Live data from Hacker News

Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

github.com

21–30 of 141 posts

Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

#21
Very nice! How does it handle CSVs that are wider or longer than the terminal? How does it deal with columns that are exceptionally long, or multiline?

Often when working with large CSV files, I'll need to show or hide specific columns, especially if they are very long. Also, grepping the output for a specific line will hide the header as well, not to mention make the output unnecessarily wide if non-matching lines have longer fields than do the matching lines. So a built-in grepping feature would make this very useful.

Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

#22

It's very weird for a project made to "maximize viewer enjoyment" to not put a space after the prompt. The one saved character on the line is definitely not worth the illegible resulting line: this doesn't maximize my enjoyment at all when viewing the examples.

Some might call this comment petty, but that was making my brain itch too.

Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

#23

It's very weird for a project made to "maximize viewer enjoyment" to not put a space after the prompt. The one saved character on the line is definitely not worth the illegible resulting line: this doesn't maximize my enjoyment at all when viewing the examples.

That's a really uncharitable comment considering it the developers prompt and has nothing to do with `tv` aside from appearing in the asciinema demo.

Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

#24
post #14

Why not visidata? https://www.visidata.org/ https://www.youtube.com/watch?v=N1CBDTgGtOU (It does much, much more than pretty printing, but no reason you can't use it for that.)

Visidata is a great interactive tool. TV seems like it would be better when scripting, or in one-liners.

For scripting I would use grep and cut, maybe awk. For scripting with CSV files, at least in my experience, you usually want specific columns from specific lines.

If TV had a switch for specifying only certain columns, that would make the job much easier.

Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

#25
post #12

I spend a lot of time in the terminal and want to quickly glance at a csv files without making a new script, opening excel, or using a tui. I made tidy-viewer (tv) because current tools like cat and column were not pretty enough. tv modifies raw files in the following ways: 1. NA detection and highlighting 2. Printing only significant digits 3. Header and footer meta data I have been using this a lot at work. There i…

I think it's a great first effort, but there are a number of possible improvements to do. The most obvious one would be to support passing the file as an argument instead of using cat or the redirection operator every time. It's great that it works with stdin to allow piping into it, but it's cumbersome if you just want to take a file and print it, which will no doubt be a common use case.

Do you think ‘tv I think it’s great for a visualizer like this to encourage people to get used to the power of shell pipelines if possible.

Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

#27

This looks great. How well does it handle the edge cases of CSV, like escaped commas, quoted text, escaped quotes, and all that fun, fun stuff?

Pretty well, I'd guess. It uses a well-tested CSV library.

Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment

#29

I spend a lot of time in the terminal and want to quickly glance at a csv files without making a new script, opening excel, or using a tui. I made tidy-viewer (tv) because current tools like cat and column were not pretty enough. tv modifies raw files in the following ways: 1. NA detection and highlighting 2. Printing only significant digits 3. Header and footer meta data I have been using this a lot at work. There i…

First of all - kudos on tackling this task - it is indeed very annoying to get CSVs to render nicely on a terminal.

1. How does tidy-viewer compare with csvlook?

2. Looking at the demo video, there seems to be an odd fixation with "N/A". The CSV spec, AFAIK, doesn't recognize this phrase. I don't understand why someone would expect a quoted string field whose raw characters are "n/a" should be rendered as anything other than n/a (i.e. lowercase and without the quotes). I'm guessing maybe in your workflow you want to use that phrase a lot, but for a tool for the general public I'd not do this kind of interpretation; and I would leave an empty field as empty.

3. tidy-viewer seems to require "unstable library features", or at least ones which were unstable as of Rust 1.48.0 . It would be nice if you could be compatible with older rust distributions/versions.

4. Many systems, especially older ones, especially ones which you access remotely and don't have root privileges on, won't have a rust installation. It would be even more convenient if you could provide binaries with little or no extra dynamic library dependencies, which could be used on older / rustless systems. I realize this is a tall order, however.

5. What about scrolling? The worst part of viewing CSVs is having to handle wide ones which exceed the terminal width, and having decent horizontal as well as vertical scrolling ability. less doesn't cut it, because it doesn't keep the header row, plus it doesn't recognize field widths.

6. tidy-viewer does not seem to support wrapping longer fields onto multiple terminal lines.

7. When the user doesn't specify the color scheme, are you choosing one based on the terminal colors, or are you using absolute color values? I suggest the former.

8. tidy-viewer loads and parses the entire CSV immediately; and, in fact, seems to keep two copies of it in memory at once. This means it cannot be used with large files without thrashing; and even if your CSV does fit in global memory, it will still be kind of unusable, trying to dump gigabytes onto the terminal.

Bottom line: A nice initial effort, but the more serious challenges are yet to be tackled, plus needs to be more robustly cross-platform.

Post reply on HN