When there is no login detected, list all possible logins to select

This commit is contained in:
Lunny Xiao
2025-10-03 12:06:31 -07:00
parent 4f33146b70
commit 376476150e
61 changed files with 270 additions and 201 deletions

View File

@@ -6,6 +6,7 @@ package branches
import (
stdctx "context"
"code.gitea.io/tea/cmd/base"
"code.gitea.io/tea/cmd/flags"
"code.gitea.io/tea/modules/context"
"code.gitea.io/tea/modules/print"
@@ -38,7 +39,7 @@ var CmdBranchesList = cli.Command{
// RunBranchesList list branches
func RunBranchesList(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
owner := ctx.Owner
@@ -52,7 +53,6 @@ func RunBranchesList(_ stdctx.Context, cmd *cli.Command) error {
branches, _, err = ctx.Login.Client().ListRepoBranches(owner, ctx.Repo, gitea.ListRepoBranchesOptions{
ListOptions: flags.GetListOptions(),
})
if err != nil {
return err
}
@@ -60,7 +60,6 @@ func RunBranchesList(_ stdctx.Context, cmd *cli.Command) error {
protections, _, err = ctx.Login.Client().ListBranchProtections(owner, ctx.Repo, gitea.ListBranchProtectionsOptions{
ListOptions: flags.GetListOptions(),
})
if err != nil {
return err
}

View File

@@ -7,6 +7,7 @@ import (
stdctx "context"
"fmt"
"code.gitea.io/tea/cmd/base"
"code.gitea.io/tea/cmd/flags"
"code.gitea.io/tea/modules/context"
@@ -45,7 +46,7 @@ var CmdBranchesUnprotect = cli.Command{
// RunBranchesProtect function to protect/unprotect a list of branches
func RunBranchesProtect(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
if !cmd.Args().Present() {