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

@@ -9,8 +9,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/araddon/dateparse"
@@ -50,7 +50,7 @@ var CmdMilestonesCreate = cli.Command{
}
func runMilestonesCreate(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
date := ctx.String("deadline")
deadline := &time.Time{}

View File

@@ -6,6 +6,7 @@ package milestones
import (
stdctx "context"
"code.gitea.io/tea/cmd/base"
"code.gitea.io/tea/cmd/flags"
"code.gitea.io/tea/modules/context"
@@ -24,7 +25,7 @@ var CmdMilestonesDelete = cli.Command{
}
func deleteMilestone(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
client := ctx.Login.Client()

View File

@@ -9,6 +9,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"
@@ -71,7 +72,7 @@ var CmdMilestoneRemoveIssue = cli.Command{
}
func runMilestoneIssueList(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
client := ctx.Login.Client()
@@ -121,7 +122,7 @@ func runMilestoneIssueList(_ stdctx.Context, cmd *cli.Command) error {
}
func runMilestoneIssueAdd(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
client := ctx.Login.Client()
if ctx.Args().Len() != 2 {
@@ -148,7 +149,7 @@ func runMilestoneIssueAdd(_ stdctx.Context, cmd *cli.Command) error {
}
func runMilestoneIssueRemove(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
client := ctx.Login.Client()
if ctx.Args().Len() != 2 {

View File

@@ -6,6 +6,7 @@ package milestones
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"
@@ -40,7 +41,7 @@ var CmdMilestonesList = cli.Command{
// RunMilestonesList list milestones
func RunMilestonesList(_ stdctx.Context, cmd *cli.Command) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
fields, err := fieldsFlag.GetValues(cmd)
@@ -64,7 +65,6 @@ func RunMilestonesList(_ stdctx.Context, cmd *cli.Command) error {
ListOptions: flags.GetListOptions(),
State: state,
})
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"
"code.gitea.io/tea/modules/print"
@@ -29,7 +30,7 @@ var CmdMilestonesReopen = cli.Command{
}
func editMilestoneStatus(_ stdctx.Context, cmd *cli.Command, close bool) error {
ctx := context.InitCommand(cmd)
ctx := base.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
if ctx.Args().Len() == 0 {
return fmt.Errorf(ctx.Command.ArgsUsage)