diff --git a/modules/context/context.go b/modules/context/context.go index cf5eb7d..fc7a7b4 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -123,8 +123,16 @@ func InitCommand(ctx *cli.Context) *TeaContext { } } else if c.Login == nil { if c.Login, err = config.GetDefaultLogin(); err != nil { - log.Fatal(err.Error()) + if err.Error() == "No available login" { + // TODO: maybe we can directly start interact.CreateLogin() (only if + // we're sure we can interactively!), as gh cli does. + fmt.Println(`No gitea login configured. To start using tea, first run + tea login add +and then run your command again.`) + } + os.Exit(1) } + fmt.Printf("NOTE: no gitea login detected, falling back to login '%s'\n", c.Login.Name) } // parse reposlug (owner falling back to login owner if reposlug contains only repo name) diff --git a/modules/task/pull_checkout.go b/modules/task/pull_checkout.go index 9beceaa..a003982 100644 --- a/modules/task/pull_checkout.go +++ b/modules/task/pull_checkout.go @@ -28,7 +28,7 @@ func PullCheckout( client := login.Client() pr, _, err := client.GetPullRequest(repoOwner, repoName, index) if err != nil { - return err + return fmt.Errorf("couldn't fetch PR: %s", err) } if err := workaround.FixPullHeadSha(client, pr); err != nil { return err