mirror of
				https://gitea.com/gitea/tea.git
				synced 2025-10-31 09:15:26 +01:00 
			
		
		
		
	When there is no login detected, list all possible logins to select
This commit is contained in:
		| @@ -10,6 +10,7 @@ import ( | ||||
| 	stdctx "context" | ||||
|  | ||||
| 	"code.gitea.io/sdk/gitea" | ||||
| 	"code.gitea.io/tea/cmd/base" | ||||
| 	"code.gitea.io/tea/cmd/flags" | ||||
| 	"code.gitea.io/tea/modules/context" | ||||
| 	"code.gitea.io/tea/modules/task" | ||||
| @@ -25,7 +26,7 @@ var CmdPullsApprove = cli.Command{ | ||||
| 	Description: "Approve a pull request", | ||||
| 	ArgsUsage:   "<pull index> [<comment>]", | ||||
| 	Action: func(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 		ctx := context.InitCommand(cmd) | ||||
| 		ctx := base.InitCommand(cmd) | ||||
| 		ctx.Ensure(context.CtxRequirement{RemoteRepo: true}) | ||||
|  | ||||
| 		if ctx.Args().Len() == 0 { | ||||
|   | ||||
| @@ -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" | ||||
| 	"code.gitea.io/tea/modules/interact" | ||||
| @@ -34,7 +35,7 @@ var CmdPullsCheckout = cli.Command{ | ||||
| } | ||||
|  | ||||
| func runPullsCheckout(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 	ctx := context.InitCommand(cmd) | ||||
| 	ctx := base.InitCommand(cmd) | ||||
| 	ctx.Ensure(context.CtxRequirement{ | ||||
| 		LocalRepo:  true, | ||||
| 		RemoteRepo: true, | ||||
|   | ||||
| @@ -8,6 +8,7 @@ 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/interact" | ||||
| @@ -32,7 +33,7 @@ var CmdPullsClean = cli.Command{ | ||||
| } | ||||
|  | ||||
| func runPullsClean(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 	ctx := context.InitCommand(cmd) | ||||
| 	ctx := base.InitCommand(cmd) | ||||
| 	ctx.Ensure(context.CtxRequirement{LocalRepo: true}) | ||||
| 	if ctx.Args().Len() != 1 { | ||||
| 		return fmt.Errorf("Must specify a PR index") | ||||
|   | ||||
| @@ -7,8 +7,8 @@ import ( | ||||
| 	stdctx "context" | ||||
|  | ||||
| 	"code.gitea.io/sdk/gitea" | ||||
| 	"code.gitea.io/tea/cmd/base" | ||||
| 	"code.gitea.io/tea/cmd/flags" | ||||
| 	"code.gitea.io/tea/modules/context" | ||||
| 	"code.gitea.io/tea/modules/interact" | ||||
| 	"code.gitea.io/tea/modules/task" | ||||
| 	"github.com/urfave/cli/v3" | ||||
| @@ -41,7 +41,7 @@ var CmdPullsCreate = cli.Command{ | ||||
| } | ||||
|  | ||||
| func runPullsCreate(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 	ctx := context.InitCommand(cmd) | ||||
| 	ctx := base.InitCommand(cmd) | ||||
|  | ||||
| 	// no args -> interactive mode | ||||
| 	if ctx.NumFlags() == 0 { | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import ( | ||||
| 	stdctx "context" | ||||
| 	"fmt" | ||||
|  | ||||
| 	"code.gitea.io/tea/cmd/base" | ||||
| 	"code.gitea.io/tea/modules/context" | ||||
| 	"code.gitea.io/tea/modules/print" | ||||
| 	"code.gitea.io/tea/modules/utils" | ||||
| @@ -17,7 +18,7 @@ import ( | ||||
|  | ||||
| // editPullState abstracts the arg parsing to edit the given pull request | ||||
| func editPullState(_ stdctx.Context, cmd *cli.Command, opts gitea.EditPullRequestOption) error { | ||||
| 	ctx := context.InitCommand(cmd) | ||||
| 	ctx := base.InitCommand(cmd) | ||||
| 	ctx.Ensure(context.CtxRequirement{RemoteRepo: true}) | ||||
| 	if ctx.Args().Len() == 0 { | ||||
| 		return fmt.Errorf("Please provide a Pull Request index") | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import ( | ||||
| 	stdctx "context" | ||||
|  | ||||
| 	"code.gitea.io/sdk/gitea" | ||||
| 	"code.gitea.io/tea/cmd/base" | ||||
| 	"code.gitea.io/tea/cmd/flags" | ||||
| 	"code.gitea.io/tea/modules/context" | ||||
| 	"code.gitea.io/tea/modules/print" | ||||
| @@ -30,7 +31,7 @@ var CmdPullsList = cli.Command{ | ||||
|  | ||||
| // RunPullsList return list of pulls | ||||
| func RunPullsList(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 	ctx := context.InitCommand(cmd) | ||||
| 	ctx := base.InitCommand(cmd) | ||||
| 	ctx.Ensure(context.CtxRequirement{RemoteRepo: true}) | ||||
|  | ||||
| 	state := gitea.StateOpen | ||||
| @@ -46,7 +47,6 @@ func RunPullsList(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 	prs, _, err := ctx.Login.Client().ListRepoPullRequests(ctx.Owner, ctx.Repo, gitea.ListPullRequestsOptions{ | ||||
| 		State: state, | ||||
| 	}) | ||||
|  | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import ( | ||||
| 	stdctx "context" | ||||
|  | ||||
| 	"code.gitea.io/sdk/gitea" | ||||
| 	"code.gitea.io/tea/cmd/base" | ||||
| 	"code.gitea.io/tea/cmd/flags" | ||||
| 	"code.gitea.io/tea/modules/context" | ||||
| 	"code.gitea.io/tea/modules/interact" | ||||
| @@ -41,7 +42,7 @@ var CmdPullsMerge = cli.Command{ | ||||
| 		}, | ||||
| 	}, flags.AllDefaultFlags...), | ||||
| 	Action: func(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 		ctx := context.InitCommand(cmd) | ||||
| 		ctx := base.InitCommand(cmd) | ||||
| 		ctx.Ensure(context.CtxRequirement{RemoteRepo: true}) | ||||
|  | ||||
| 		if ctx.Args().Len() != 1 { | ||||
|   | ||||
| @@ -8,6 +8,7 @@ import ( | ||||
| 	"fmt" | ||||
| 	"strings" | ||||
|  | ||||
| 	"code.gitea.io/tea/cmd/base" | ||||
| 	"code.gitea.io/tea/cmd/flags" | ||||
| 	"code.gitea.io/tea/modules/context" | ||||
| 	"code.gitea.io/tea/modules/task" | ||||
| @@ -24,7 +25,7 @@ var CmdPullsReject = cli.Command{ | ||||
| 	Description: "Request changes to a pull request", | ||||
| 	ArgsUsage:   "<pull index> <reason>", | ||||
| 	Action: func(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 		ctx := context.InitCommand(cmd) | ||||
| 		ctx := base.InitCommand(cmd) | ||||
| 		ctx.Ensure(context.CtxRequirement{RemoteRepo: true}) | ||||
|  | ||||
| 		if ctx.Args().Len() < 2 { | ||||
|   | ||||
| @@ -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" | ||||
| 	"code.gitea.io/tea/modules/interact" | ||||
| @@ -22,7 +23,7 @@ var CmdPullsReview = cli.Command{ | ||||
| 	Description: "Interactively review a pull request", | ||||
| 	ArgsUsage:   "<pull index>", | ||||
| 	Action: func(_ stdctx.Context, cmd *cli.Command) error { | ||||
| 		ctx := context.InitCommand(cmd) | ||||
| 		ctx := base.InitCommand(cmd) | ||||
| 		ctx.Ensure(context.CtxRequirement{RemoteRepo: true}) | ||||
|  | ||||
| 		if ctx.Args().Len() != 1 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lunny Xiao
					Lunny Xiao