feat(org): org +members 支持 --all 自动翻页(资源键 organization_users)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
laurencewannamaker 2026-07-05 23:13:51 +00:00
parent e225b86e80
commit 2a92ac33dd
2 changed files with 11 additions and 2 deletions

View File

@ -16,7 +16,7 @@
- 遵循 `total_count`:达到总数即停止;另设最大页数护栏,防止
忽略 `page` 参数的端点造成死循环。
- `PaginateAll` 保持原签名,委托给 `PaginateAllKey`
- 十个分页 list 命令新增 `--all` 布尔参数(默认 false
- 十个分页 list 命令新增 `--all` 布尔参数(默认 false
- `issue +list --all`(合并结果同样应用 number/database_id 规范化)
- `pr +list --all`、`branch +list --all`、`release +list --all`
- `milestone +list --all`、`org +list --all`、`repo +list --all`
@ -24,7 +24,8 @@
- `label +list --all`、`member +list --all`、`webhook +list --all`
- `issue +comments --all`(新增子命令,见下)
- `tag +list --all`、`commit +list --all`(新增命令组,见下)
- `repo +watchers/+stargazers/+forks --all`
- `repo +watchers/+stargazers/+forks --all`、`org +members --all`
(资源键 `organization_users`,生产实测 gitlink 组织 71 名成员全量合并)
- 对应资源键:`issues`/`pulls`/`branches`/`releases`/`milestones`/
`organizations`/`projects`/`users`/`issue_tags`/`collaborators`/`webhooks`
(均生产实测确认)

View File

@ -59,12 +59,20 @@ func Shortcuts(translators ...*i18n.Translator) []*common.Shortcut {
{Name: "id", Short: "i", Usage: tr.T("flag.org.id"), Required: true},
{Name: "page", Short: "p", Usage: tr.T("flag.page"), Default: "1"},
{Name: "limit", Short: "l", Usage: tr.T("flag.limit"), Default: "20"},
{Name: "all", Usage: tr.T("flag.all"), Bool: true, Default: "false"},
},
Run: func(ctx *common.RuntimeContext) error {
id, _ := ctx.RequireArg("id")
q := url.Values{}
q.Set("page", ctx.Arg("page"))
q.Set("limit", ctx.Arg("limit"))
if ctx.Arg("all") == "true" {
items, err := ctx.PaginateAllKey(fmt.Sprintf("/organizations/%s/organization_users", id), q, "organization_users")
if err != nil {
return err
}
return ctx.Output(common.NewListEnvelope("organization_users", items))
}
env, err := ctx.CallAPIWithQuery("GET", fmt.Sprintf("/organizations/%s/organization_users", id), q)
if err != nil {
return err