News for hackers. Stuff that matters.
Re:Show HN: Tidy Viewer – a cross-platform CSV pretty printe... by mileza on Monday September 27, 2021 @10:27AM (#28671031)
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.
Re:Show HN: Tidy Viewer – a cross-platform CSV pretty printe... by MobiusHorizons on Monday September 27, 2021 @11:00AM (#28671451)
Do you think ‘tv <file.csv’ does what you want well enough? What is the behavior when you run ‘tv file.csv’ does it just block waiting for input?

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 printe... by GuB-42 on Monday September 27, 2021 @01:22PM (#28673490)
It works, but almost all UNIX commands that work on pipelines can take a list of files as arguments. Out of the commands I use regularly, "patch" is the only one that works exclusively from stdin, probably because file arguments have a different, somewhat obscure, and probably historical meaning.

If appropriate, using files as arguments instead of using shell pipelines is a best practice. Commands can optimize for that use case, print better error messages, etc...

And it is not a good thing to encourage useless use of cat. If you goal is to show how your tool is to be used with pipelines, show an actually useful pipeline for example "sed '1b;/abc/!d' file.csv | tv". The "sed" command prints the first line (header), and all lines containing "abc".

Re:Show HN: Tidy Viewer – a cross-platform CSV pretty printe... by MobiusHorizons on Tuesday September 28, 2021 @11:26AM (#28683931)
Fair enough.
Re:Show HN: Tidy Viewer – a cross-platform CSV pretty printe... by Someone on Monday September 27, 2021 @12:13PM (#28672552)
I think it’s a bad idea to go against half a century of conventions without good reason.

It’s very surprising to see a tool that only works as a filter, and doesn’t take file paths as arguments.