Use bubbletea instead of survey for interacting with TUI (#786)

Fix #772

Reviewed-on: https://gitea.com/gitea/tea/pulls/786
Reviewed-by: Bo-Yi Wu (吳柏毅) <appleboy.tw@gmail.com>
This commit is contained in:
Lunny Xiao
2025-08-11 18:23:52 +00:00
parent c0eb30af03
commit 4c00b8b571
27 changed files with 553 additions and 318 deletions

View File

@ -7,12 +7,12 @@ import (
"fmt"
"strings"
"code.gitea.io/sdk/gitea"
"code.gitea.io/tea/modules/context"
"code.gitea.io/tea/modules/task"
"code.gitea.io/tea/modules/utils"
"github.com/AlecAivazis/survey/v2"
"code.gitea.io/sdk/gitea"
"github.com/charmbracelet/huh"
)
// MergePull interactively creates a PR
@ -76,15 +76,15 @@ func getPullIndex(ctx *context.TeaContext, branch string) (int64, error) {
prOptions = append(prOptions, loadMoreOption)
q := &survey.Select{
Message: "Select a PR to merge",
Options: prOptions,
PageSize: 10,
}
err = survey.AskOne(q, &selected)
if err != nil {
if err := huh.NewSelect[string]().
Title("Select a PR to merge:").
Options(huh.NewOptions(prOptions...)...).
Value(&selected).
Filtering(true).
Run(); err != nil {
return 0, err
}
if selected != loadMoreOption {
break
}