fix: address verified review findings (labels-milestones-time-1)

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-18 17:40:59 +02:00
1 parent be3b8a1ced
commit e28bb6e039
21 files changed
+262 -47

No files matched your search

+11 -5
View File
@@ -45,11 +45,17 @@ $ tea milestone list --state all --json title,due_on,open_issues,closed_issues`,
if err != nil {
return err
}
items, err := s.ListPage(cmd.Context(), state, limit, page)
// Gitea pages milestones by due date alone, so the order is applied to all of them first.
all, err := s.AllIn(cmd.Context(), state)
if err != nil {
return err
}
slices.SortStableFunc(items.Items, compareMilestones)
slices.SortStableFunc(all, compareMilestones)
start := len(all)
if page-1 <= len(all)/limit {
start = min((page-1)*limit, len(all))
}
items := services.Page[services.Milestone]{Items: all[start:min(start+limit, len(all))], More: start+limit < len(all), Total: len(all), Counted: true}
what := "milestones in " + t.Repo
if state != "all" {
what = state + " " + what
@@ -159,7 +165,7 @@ $ tea milestone view 3 --web`, Annotations: map[string]string{"tea.arguments": m
}}
cmd.Flags().BoolVar(&byName, "by-name", false, "Match a numeric argument as a milestone title rather than an ID")
cmd.Flags().BoolVarP(&web, "web", "w", false, "Open the milestone in the browser")
cmd.ValidArgsFunction = firstArg(a.completeMilestones())
cmd.ValidArgsFunction = firstArg(a.completeMilestonesIn("all"))
return cmd
}
@@ -334,7 +340,7 @@ $ tea milestone edit 3 --editor`, Annotations: map[string]string{"tea.arguments"
}}
fields.register(cmd)
cmd.Flags().BoolVar(&byName, "by-name", false, "Match a numeric argument as a milestone title rather than an ID")
cmd.ValidArgsFunction = firstArg(a.completeMilestones())
cmd.ValidArgsFunction = firstArg(a.completeMilestonesIn("all"))
return cmd
}
@@ -361,7 +367,7 @@ $ tea milestone delete 7 --yes`, Annotations: map[string]string{"tea.confirm": "
return a.jsonResult(cmd, item)
}}
cmd.Flags().BoolVar(&byName, "by-name", false, "Match a numeric argument as a milestone title rather than an ID")
cmd.ValidArgsFunction = firstArg(a.completeMilestones())
cmd.ValidArgsFunction = firstArg(a.completeMilestonesIn("all"))
return cmd
}