fix(sheets): respect --plain flag for TSV output in metadata command#298
Merged
steipete merged 2 commits intosteipete:mainfrom Mar 7, 2026
Merged
Conversation
…V output The `sheets metadata` command was using `tabwriter.NewWriter` directly instead of the `tableWriter` helper, which converts tab characters to spaces for visual alignment. This broke `--plain` mode, which documents stable TSV output for piping to external tools. Changes: - Replace direct `tabwriter.NewWriter` in `SheetsMetadataCmd` with `tableWriter(ctx)` helper (which already respects `IsPlain`) - Remove unused `text/tabwriter` import from sheets.go - Fix type mismatch in `contactsApplyPersonName` and `contactsApplyPersonOrganization` function signatures (#285) - Add tests for plain TSV output in both `sheets get` and `sheets metadata` commands Fixes #209 Fixes #285
64563cf to
057cbc7
Compare
Owner
|
Landed via temp rebase onto main. Thanks @mahsumaktas! |
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
…teipete#298) * fix(sheets): use tableWriter helper in metadata to respect --plain TSV output The `sheets metadata` command was using `tabwriter.NewWriter` directly instead of the `tableWriter` helper, which converts tab characters to spaces for visual alignment. This broke `--plain` mode, which documents stable TSV output for piping to external tools. Changes: - Replace direct `tabwriter.NewWriter` in `SheetsMetadataCmd` with `tableWriter(ctx)` helper (which already respects `IsPlain`) - Remove unused `text/tabwriter` import from sheets.go - Fix type mismatch in `contactsApplyPersonName` and `contactsApplyPersonOrganization` function signatures (steipete#285) - Add tests for plain TSV output in both `sheets get` and `sheets metadata` commands Fixes steipete#209 Fixes steipete#285 * fix(sheets): respect plain TSV output in metadata (steipete#298) (thanks @mahsumaktas) --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
sheets metadata --plainto output real tab-delimited values instead of space-padded columns. Also fixes a type mismatch build error incontacts_crud.go.Problem
The
sheets metadatacommand usedtabwriter.NewWriterdirectly instead of thetableWriter(ctx)helper. The helper already checksoutfmt.IsPlain(ctx)and bypassestabwriterwhen--plainis set — butmetadatawas not using it.This caused
--plainoutput to have space-padded columns instead of real\tdelimiters, breaking piping to tools likecut,awk, orcsvtoolthat expect TSV.Changes
internal/cmd/sheets.gotabwriter.NewWriterwithtableWriter(ctx)inSheetsMetadataCmd; remove unusedtext/tabwriterimportinternal/cmd/contacts_crud.gostringtype togivenandorgparameters in helper functionsinternal/cmd/sheets_plain_test.go--plainmode for bothsheets getandsheets metadataTesting
Related Issues
sheets get --plainoutputs spaces instead of tabscontacts_crud.go