Earlier quoted context omitted.
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.
Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
111–120 of 141 posts
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#112This 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?
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#113Earlier quoted context omitted.
Unless your csv has embedded line breaks
Can you give an example of what you mean? If it breaks tv then I would like to add it to the automated tests and see if we can work on it.
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#114Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#115Earlier quoted context omitted.
Can you give an example of what you mean? If it breaks tv then I would like to add it to the automated tests and see if we can work on it.
No sorry, I assume tv is fine. The problem is in assuming `head -n5` gives you 5 rows and piping that into tv.
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#116Earlier quoted context omitted.
If the goal is to calculate the correct column width, you have to do one pass through the data before writing the first row. If the file can be read multiple times (not a UNIX stream), you can just read the file twice. If the file is a stream, instead of retaining the entire dataset in memory, you can write to a temporary file and re-parse it after calculating the widths.
The correct column width is calculated from the first n rows not the full file. A stream does not work for tv because a stream does not know how many rows are in the file a priori. Displaying the dimensions of the file is a priority for `tv`. I am very happy with that trade-off. I would rather know the dimensions of a file than have a file stream of unknown dimensions.
I'm not saying you should or shouldn't, but your use case doesn't bar you from using streams.
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#117Earlier quoted context omitted.
The correct column width is calculated from the first n rows not the full file. A stream does not work for tv because a stream does not know how many rows are in the file a priori. Displaying the dimensions of the file is a priority for `tv`. I am very happy with that trade-off. I would rather know the dimensions of a file than have a file stream of unknown dimensions.
If you did it the way he's talking about you would stream through the file to find how many rows and write the file as a temp file that you could re-parse for the actual data. I'm not saying you should or shouldn't, but your use case doesn't bar you from using streams.
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#118Earlier quoted context omitted.
Man.. TV is such a good name for a visualiser tool that it'd be excellent if it could pretty-print any content given to it. Does your framework support the idea of pre-parsing the file's content and selecting an appropriate renderer, or is it fairly tied to CSVs?
I actually like `tidy` better and honestly would rather have `cat a.csv | tidy ...`. But it's probably already a thing.
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#119Hey, great start. I spend half my day in CSVs and I am definitely your target audience. Most of the time I use bat, visidata or tabview. In many ways tabview is the best, though recently the project has been abandoned. tv looks excellent. Fun name. I think if you added a couple of features it would ascend to my toolbox: (1) scrolling (horizontal and vertical) (2) better command line parsing. Running "tv" without stdi…
Re: Show HN: Tidy Viewer – a cross-platform CSV pretty printer for viewer enjoyment
#120Earlier quoted context omitted.
Or: head -n5 data/a.csv | tv
Unless your csv has embedded line breaks
cat data/a.csv | tv | head -n5
It is more resource intensive, but it pushes the problem you mentioned onto tv. If tv doesn't work with embedded EOLs, then you need to fix your data or fix your tool.