feat(milestone): milestone tables, views, forms and one selection model

milestone view printed the list row, and milestone list hid the due date
and progress. milestone list now shows ID TITLE [STATE] DUE PROGRESS, open
milestones first and by due date; milestone view shows the state, due
date, progress, description and the milestone's web page (also --web).

Every milestone command addresses milestones by title or ID. Mutations
report ✓ lines: milestone create also prints the new milestone's URL and
takes the title as an argument; close and reopen skip milestones already
in that state; delete names the milestone in its confirmation; milestone
issue add and remove report one line such as "✓ Added #1, #2 to
milestone "v1.0" in alice/x". milestone issue list uses the issue table.
milestone edit without flags on a terminal opens the milestone form with
the current values, and every milestone command completes milestone
titles and has help text with examples.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 00:17:02 +02:00
1 parent 2ba02cf915
commit c161a63eb6
14 files changed
+606 -257

No files matched your search

+7 -6
View File
@@ -76,7 +76,7 @@ $ tea issue list --search "login" --web`, Args: argsExact(0), RunE: func(cmd *co
if err != nil {
return err
}
return writeTable(a, cmd, page.Items, issueListSpec(target.Repo, opts.State, opts.Kind, filtered), servicePage(page, opts.Page))
return writeTable(a, cmd, page.Items, issueListSpec("in "+target.Repo, opts.State, opts.Kind, filtered), servicePage(page, opts.Page))
}}
enumFlag(cmd, &opts.State, "state", "s", "open", "Filter by state", "open", "closed", "all")
enumFlag(cmd, &opts.Kind, "kind", "", "issues", "List issues, pull requests or both", "issues", "pulls", "all")
@@ -112,9 +112,10 @@ func issuesURL(t target, opts services.ListOptions) string {
return strings.TrimRight(t.Host, "/") + "/" + t.Repo + "/" + section + "?" + query.Encode()
}
// issueListSpec describes issue tables: STATE shows on a terminal unless only open issues are
// listed, and KIND when issues and pull requests are; piped tables always have both.
func issueListSpec(repo, state, kind string, filtered bool) listSpec[services.Issue] {
// issueListSpec describes issue tables of the issues where, such as "in alice/x": STATE shows on a
// terminal unless only open issues are listed, and KIND when issues and pull requests are; piped
// tables always have both.
func issueListSpec(where, state, kind string, filtered bool) listSpec[services.Issue] {
what := map[string]string{"issues": "issues", "pulls": "pull requests", "all": "issues and pull requests"}[kind]
if state != "all" {
what = state + " " + what
@@ -134,8 +135,8 @@ func issueListSpec(repo, state, kind string, filtered bool) listSpec[services.Is
{Header: "Updated"},
},
Row: issueRow,
Empty: empty + " in " + repo,
Context: what + " in " + repo,
Empty: empty + " " + where,
Context: what + " " + where,
}
}