Repository navigation
Conversation
Fixes openfga#569 Signed-off-by: Srinivas Chippagiri <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Walkthrough
ChangesTuple read output
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant TupleRead
participant DisplayReadResponse
participant FileWriter
participant OutputRender
participant OutputFile
TupleRead->>DisplayReadResponse: pass response, format, and output path
DisplayReadResponse->>FileWriter: write response to the selected path
FileWriter->>OutputRender: render non-CSV output
OutputRender-->>FileWriter: return formatted bytes
FileWriter->>OutputFile: write bytes with 0600 permissions
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
Fixes #569
Adds an optional
--output-fileflag tofga tuple read, following the proposal in the issue.--output-format(json,simple-json,yamlorcsv).0600permissions, and only after the output has been produced, so a conversion error does not leave a partial file. An error is returned if the file cannot be written.This adds
output.Render(JSON/YAML without colors, returning bytes) and splits the display code incmd/tuple/read.gointodisplayReadResponseandwriteReadResponseToFile. The README documents the new flag.Tests: file output for json, simple-json, yaml and csv (content and permissions), that the simple-json file parses back into tuple keys, the write error case, and
Render. I rango test ./cmd/tuple -run "DisplayReadResponse|TestRead"andgo test ./internal/output. A different test incmd/tuple(TestParseTuplesFileData) fails on Windows because it compares an OS error message; it is unrelated to this change.Summary by CodeRabbit
--output-fileoption totuple readto save results in the selected format instead of printing them to standard output. Output files are created with restricted permissions.