Unified · Split
| @@ -58,14 +58,19 @@ func DoLogin(cfg *config.Config, projectID string, options *LoginOptions) { · 57 unmodified lines | ||
| 58 | 58 | promptFn := options.Prompt |
| 59 | 59 | if promptFn == nil { |
| 60 | 60 | promptFn = defaultProjectPrompt() |
| 61 | − options.Prompt = promptFn | |
| 61 | + } | |
| 62 | + | |
| 63 | + trimmedProjectID := strings.TrimSpace(projectID) | |
| 64 | + callbackPrompt := promptFn | |
| 65 | + if trimmedProjectID == "" { | |
| 66 | + callbackPrompt = nil | |
| 62 | 67 | } |
| 63 | 68 | |
| 64 | 69 | loginOpts := &sdkAuth.LoginOptions{ |
| 65 | 70 | NoBrowser: options.NoBrowser, |
| 66 | − ProjectID: strings.TrimSpace(projectID), | |
| 71 | + ProjectID: trimmedProjectID, | |
| 67 | 72 | Metadata: map[string]string{}, |
| 68 | − Prompt: promptFn, | |
| 73 | + Prompt: callbackPrompt, | |
| 69 | 74 | } |
| 70 | 75 | |
| 71 | 76 | authenticator := sdkAuth.NewGeminiAuthenticator() |
| @@ -84,7 +89,7 @@ func DoLogin(cfg *config.Config, projectID string, options *LoginOptions) { · 12 unmodified lines | ||
| 84 | 89 | geminiAuth := gemini.NewGeminiAuth() |
| 85 | 90 | httpClient, errClient := geminiAuth.GetAuthenticatedClient(ctx, storage, cfg, &gemini.WebLoginOptions{ |
| 86 | 91 | NoBrowser: options.NoBrowser, |
| 87 | − Prompt: promptFn, | |
| 92 | + Prompt: callbackPrompt, | |
| 88 | 93 | }) |
| 89 | 94 | if errClient != nil { |
| 90 | 95 | log.Errorf("Gemini authentication failed: %v", errClient) |
| @@ -99,7 +104,7 @@ func DoLogin(cfg *config.Config, projectID string, options *LoginOptions) { · 8 unmodified lines | ||
| 99 | 104 | return |
| 100 | 105 | } |
| 101 | 106 | |
| 102 | − selectedProjectID := promptForProjectSelection(projects, strings.TrimSpace(projectID), promptFn) | |
| 107 | + selectedProjectID := promptForProjectSelection(projects, trimmedProjectID, promptFn) | |
| 103 | 108 | projectSelections, errSelection := resolveProjectSelections(selectedProjectID, projects) |
| 104 | 109 | if errSelection != nil { |
| 105 | 110 | log.Errorf("Invalid project selection: %v", errSelection) |