feat: add --name filter to store list - #745
Conversation
The ListStores API already accepts a name filter, so wire it up on the CLI. Adds a --name flag to fga store list and passes it through as Name on ClientListStoresOptions. Only set when non-empty so existing behavior is unchanged. Closes openfga#552 Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
|
|
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. WalkthroughChangesStore name filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds an optional store-name filter while preserving existing default behavior and pagination. The documented checks and tests pass, so no actionable merge-blocking risk remains beyond normal review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant CLI
participant listStores
participant SDK
CLI->>listStores: pass name filter
listStores->>SDK: set ClientListStoresOptions.Name
SDK-->>listStores: return filtered stores
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
👋 @ChrisJr404 Can you please sign the EasyCLA |
Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
Siddhant-K-code
left a comment
There was a problem hiding this comment.
@ChrisJr404, overall it looks good, just some suggestion comments (above)
|
Thanks, updated the help text to say it filters by exact name, and added --name plus a filtered example to both the summary row and the List Stores section in the README. |
SoulPancake
left a comment
There was a problem hiding this comment.
Tiny nit, totally non-blocking: the cobra Example: in list.go still only shows fga store list, so folks running --help won't see the new flag in action (the README got the filtered example, but help text is where most people look first). Other commands like store create and tuple write already use multi-line examples, so something like:
Example: `fga store list
fga store list --name "FGA Demo Store"`,would give help-text parity.
Nice work! 🎉
Adds a
--nameflag tofga store listso you can filter stores by name, matching the filter the ListStores API already supports.The flag binds to a string that gets passed through as
NameonClientListStoresOptions. It's only set when non-empty, so the defaultfga store listbehaves exactly as before and the existing pagination path is untouched.Fixes #552. The issue was assigned back in Hacktoberfest 2025 but no PR ever came of it, so picking it up here.
Testing
Added
TestListStoresWithNamewhich asserts--namereaches the SDK options via the gomockOptions(...)expectation, alongside the existing list tests (updated for the new param).go build ./...,go vet ./cmd/store/...,gofmt -l, andgo test ./cmd/store/...all pass. Also updated the store-list parameter list in the README.Summary by CodeRabbit
New Features
--namefilter to thefga store listcommand.Documentation
--nameoption and its usage.