Add --json option to list CLI commands#399
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a --json flag to the reader list feeds and reader list entries CLI commands to support JSON Lines output for scripting/pipelines, while keeping the existing plain-text output as the default.
Changes:
- Add
--jsonoption tolist feedsandlist entries. - Serialize feed/entry objects to JSON (currently via
_hash_utils._dataclass_dictandjson.dumps()).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@lemon24 Should I implement changes recommend by copilot? |
lemon24
left a comment
There was a problem hiding this comment.
Left some comments (some as replies to the Copilot ones).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #399 +/- ##
=======================================
Coverage 94.27% 94.28%
=======================================
Files 103 103
Lines 13510 13529 +19
Branches 997 999 +2
=======================================
+ Hits 12737 12756 +19
Misses 692 692
Partials 81 81 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3bd40ee to
d27c056
Compare
for more information, see https://pre-commit.ci
lemon24
left a comment
There was a problem hiding this comment.
Looks good, after this round of comments it should be good to go!
|
|
||
| """ | ||
| def entries(reader, json_output): | ||
| """List all the entries.""" |
There was a problem hiding this comment.
Per previous comment, this docstring should be left unchanged (no additions, no removals).
There was a problem hiding this comment.
Still missing the "Outputs one line per entry in the following format: ..." part, I'll fix it after merge.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
@puneetdixit200, thank you for the PR! |
Adds a --json flag to the
list feedsandlist entriesCLI commands.When used, output is emitted as JSON Lines (one JSON object per line), making it easier to use in scripts and pipelines.
Implementation details:
_json_defaultfor serialization (handles dataclasses and datetime)Tests:
--jsonoutputcatch_exceptionsargument fromCliRunnerExample usage: