mirror of
				https://gitea.com/gitea/tea.git
				synced 2025-11-04 03:05:26 +01:00 
			
		
		
		
	don't fallback login directly (#806)
Fix #499 Reviewed-on: https://gitea.com/gitea/tea/pulls/806
This commit is contained in:
		@@ -15,8 +15,10 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	"code.gitea.io/tea/modules/config"
 | 
						"code.gitea.io/tea/modules/config"
 | 
				
			||||||
	"code.gitea.io/tea/modules/git"
 | 
						"code.gitea.io/tea/modules/git"
 | 
				
			||||||
 | 
						"code.gitea.io/tea/modules/theme"
 | 
				
			||||||
	"code.gitea.io/tea/modules/utils"
 | 
						"code.gitea.io/tea/modules/utils"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/charmbracelet/huh"
 | 
				
			||||||
	gogit "github.com/go-git/go-git/v5"
 | 
						gogit "github.com/go-git/go-git/v5"
 | 
				
			||||||
	"github.com/urfave/cli/v3"
 | 
						"github.com/urfave/cli/v3"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -135,7 +137,18 @@ and then run your command again.`)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			os.Exit(1)
 | 
								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)
 | 
						// parse reposlug (owner falling back to login owner if reposlug contains only repo name)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user