feat: switch gitea login from tea to gt
This commit is contained in:
1 parent
9ebb35860c
commit
a1cfcc1de7
4 files changed
+186
-27
No files matched your search
@@ -86,10 +86,10 @@ func runGitea(ctx context.Context, args []string) error {
|
||||
clientID := fs.String("client-id", defaultClientID, "Gitea OAuth2 client ID (or LATHA_GITEA_CLIENT_ID)")
|
||||
giteaURL := fs.String("gitea-url", gitea.DefaultGiteaURL, "Gitea base URL")
|
||||
relayURL := fs.String("relay-url", gitea.DefaultRelayURL, "OAuth callback relay base URL")
|
||||
loginName := fs.String("name", gitea.DefaultTeaName, "tea login name")
|
||||
teaBin := fs.String("tea-bin", "", "Path to tea binary (optional)")
|
||||
gtBin := fs.String("gt-bin", "", "Path to gt binary (optional)")
|
||||
credentialStore := fs.String("credential-store", "auto", "Credential store for gt: auto, keyring, or file")
|
||||
timeout := fs.Duration("timeout", 5*time.Minute, "Authorization timeout")
|
||||
noTea := fs.Bool("no-tea", false, "Skip configuring tea/git credentials and print access token")
|
||||
noGT := fs.Bool("no-gt", false, "Skip configuring gt/git credentials and print access token")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -125,16 +125,16 @@ func runGitea(ctx context.Context, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if *noTea {
|
||||
if *noGT {
|
||||
fmt.Println(tok.AccessToken)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := gitea.ConfigureTeaAndGit(ctx, *teaBin, *loginName, *giteaURL, tok.AccessToken); err != nil {
|
||||
if err := gitea.ConfigureGTAndGit(ctx, *gtBin, *giteaURL, tok.AccessToken, *credentialStore); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("Configured tea login %q (%s) and git credentials.\n", *loginName, *giteaURL)
|
||||
fmt.Printf("Configured gt login (%s) and git credentials.\n", *giteaURL)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user