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
cli: avoid special line at the end of CSV/TSV output #20835
Conversation
Oo, can you include an example of the before/after for the end-user in the PR? |
Review status: 0 of 9 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. pkg/cli/flags.go, line 369 at r5 (raw file):
In my mind the row count is a part of the Comments from Reviewable |
Review status: 0 of 9 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. pkg/cli/flags.go, line 369 at r5 (raw file): Previously, bdarnell (Ben Darnell) wrote…
I started making it configurable for csv/tsv (there are legitimate cases where we want a row count for them) and then I wasn't happy with having it configurable form csv/tsv. In particular it became clear that at least the html and records formatters should also have it. But then for orthogonality in docs I figured that it should be the same everywhere so the explanation remains simple. What do you think? Comments from Reviewable |
Review status: 0 of 9 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. pkg/cli/flags.go, line 369 at r5 (raw file): Previously, knz (kena) wrote…
What is that use case? The reason I was thinking it was format-specific was because I couldn't think of any time you'd want anything but CSV/TSV data when using those formats. Comments from Reviewable |
2b1342d
to
94391c5
Compare
I have removed all commits but the last and simplified the implementation. PTAL. Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion. pkg/cli/flags.go, line 369 at r5 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Okay, removed, PTAL. Comments from Reviewable |
b985932
to
e5d54ae
Compare
f344099
to
5b4da8c
Compare
Reviewed 9 of 9 files at r7. pkg/cli/format_table.go, line 289 at r7 (raw file):
Even a blank line can make things more complicated for readers. For example, python's Comments from Reviewable |
Release note: none
Prior to this patch, the csv/tsv formatters would end a table with a row count. This is not great for interoperability with external tools which may expect to be able to redirect the table output to a file and open that directly in a csv/tsv reader, where the final row count would be incorrectly interpreted as an extra row. This patch changes the behavior by omitting the row count altogether for csv/tsv output. Release note (cli change): when printing tabular results as CSV or TSV, no final row count is emitted. This is intended to increase interoperability with external tools.
5b4da8c
to
13d9e88
Compare
Removed the empty line as suggested. PTAL |
TFYR! |
Fixes #18584.
Prior to this patch, the csv/tsv formatters would end a table with a
row count. This is not great for interoperability with external tools
which may expect to be able to redirect the table output to a file and
open that directly in a csv/tsv reader, where the final row count
would be incorrectly interpreted as an extra row.
This patch changes the behavior by omitting the row count altogether
for csv/tsv output.
Release note (cli change): when printing tabular results as CSV or
TSV, no final row count is emitted. This is intended to increase
interoperability with external tools.