mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-05 21:38:13 +02:00
Adds a CLI client for the Gitea EE pull request stack API
(GET/POST /repos/{owner}/{repo}/stacks[/{id}[/entries|/restack|/merge]]):
- modules/stack holds the Stack/Entry/MergeResult types shared between
the API client and its output formatting, avoiding an import cycle
between modules/task and modules/print.
- modules/task/pull_stack.go implements the HTTP calls on top of
modules/api.Client, which gains a context-aware DoContext method.
- modules/print/pull_stack.go formats stack listings (table/json/...)
and a single stack's ordered entries.
- cmd/pulls/stack adds the list, show, push, restack and merge
subcommands, wired in as 'tea pr stack' via cmd/pulls.go, following
the repo/login flag routing used by the rest of the pulls commands.
Assisted-by: Codet:GPT-5-Codex
32 lines
749 B
Go
32 lines
749 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package pulls
|
|
|
|
import (
|
|
stdctx "context"
|
|
|
|
"gitea.dev/tea/cmd/pulls/stack"
|
|
|
|
"github.com/urfave/cli/v3"
|
|
)
|
|
|
|
// CmdPullsStack represents the stack command to manage pull request stacks
|
|
var CmdPullsStack = cli.Command{
|
|
Name: "stack",
|
|
Usage: "Manage pull request stacks",
|
|
Description: "List, show, push, restack, and merge pull request stacks",
|
|
Action: runPullsStackDefault,
|
|
Commands: []*cli.Command{
|
|
&stack.CmdStackList,
|
|
&stack.CmdStackShow,
|
|
&stack.CmdStackPush,
|
|
&stack.CmdStackRestack,
|
|
&stack.CmdStackMerge,
|
|
},
|
|
}
|
|
|
|
func runPullsStackDefault(ctx stdctx.Context, cmd *cli.Command) error {
|
|
return stack.RunStackList(ctx, cmd)
|
|
}
|