don't fallback login directly

This commit is contained in:
Lunny Xiao
2025-08-26 12:22:07 -07:00
parent 8876fe3cb8
commit f9b3261d4c

View File

@ -16,8 +16,10 @@ import (
"code.gitea.io/sdk/gitea"
"code.gitea.io/tea/modules/config"
"code.gitea.io/tea/modules/git"
"code.gitea.io/tea/modules/theme"
"code.gitea.io/tea/modules/utils"
"github.com/charmbracelet/huh"
gogit "github.com/go-git/go-git/v5"
"github.com/urfave/cli/v3"
)
@ -152,7 +154,18 @@ and then run your command again.`)
}
os.Exit(1)
}
fmt.Fprintf(os.Stderr, "NOTE: no gitea login detected, falling back to login '%s'\n", c.Login.Name)
fallback := false
if err := huh.NewConfirm().
Title(fmt.Sprintf("NOTE: no gitea login detected, whether falling back to login '%s'?", c.Login.Name)).
Value(&fallback).
WithTheme(theme.GetTheme()).
Run(); err != nil {
log.Fatalf("Get confirm failed: %v", err)
}
if !fallback {
os.Exit(1)
}
}
// parse reposlug (owner falling back to login owner if reposlug contains only repo name)