Repository navigation
feat(output): add --fields to limit JSON listings to named keys - #451
Merged
Merged
Conversation
--fields on the task listings, search and projects prints only the named JSON keys of each row, in the order given. Names are the keys as printed, read off the model's json tags; an unknown name fails with an "unknown field" error listing the valid ones. It needs --json, and show keeps the full record.
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.
Adds
--fieldsto limit-joutput to the named keys of each row, likegh --json title,url. Without it, a 94-task anytime listing is 90,150 bytes, and agents that cap output withhead -c 6000see about 6% of it.things anytime -a "Personal Projects" -j --fields uuid,title,projectTitle,deadline,tagsOn a copy of a real database this prints 15,736 bytes instead of 90,150. On
logbookit prints 129,822 bytes instead of 778,483 (withuuid,title,deadline).Where it works
today,inbox,upcoming,anytime,someday,repeating,logbook,trash,deadlines, andlistwith filters.search, which shares the listing code path.things projects.things showdoes not take it and always prints the full record.areasandtagsrows are short, so they were left out.Decisions
projectis rejected, and the error listsprojectTitleamong the valid names. Task listings take the task keys andprojectstakes the project keys. Both lists are read from the model's json tags, so a new field becomes selectable without a second list.unknown fieldcarryingkind,unknown(the names not recognised) andvalid(every accepted name).--fields ""or,) fails with the genericerrortoken.--fieldswithout--jsonfails with "needs --json". Plain output is unchanged.internal/output/fields.goand works on the marshalled rows generically.Docs
docs/content/commands.md: new section on choosing fields.docs/content/agents.md: the new error token.README.md: an entry in the output section and the new token.internal/skill/SKILL.md: a bullet and the command synopses.