Skip to content

Commit 5f89c95

Browse files
Merge pull request #170 from hdresearch/fix/signup-no-interactive-prompt
fix: remove interactive org prompt from signup, require --org flag
2 parents 3951f0d + 58f9308 commit 5f89c95

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

cmd/signup.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cmd
22

33
import (
4-
"bufio"
54
"fmt"
65
"os"
76
"strings"
@@ -103,22 +102,11 @@ func signupWithGit() error {
103102
orgName = verifyResp.Orgs[0].Name
104103
fmt.Printf("\nOrganization: %s\n", orgName)
105104
} else {
106-
fmt.Println("\nSelect an organization:")
105+
names := make([]string, len(verifyResp.Orgs))
107106
for i, org := range verifyResp.Orgs {
108-
fmt.Printf(" [%d] %s (%s)\n", i+1, org.Name, org.Role)
107+
names[i] = org.Name
109108
}
110-
fmt.Print("Enter number: ")
111-
reader := bufio.NewReader(os.Stdin)
112-
input, err := reader.ReadString('\n')
113-
if err != nil {
114-
return fmt.Errorf("failed to read input: %w", err)
115-
}
116-
input = strings.TrimSpace(input)
117-
var choice int
118-
if _, err := fmt.Sscanf(input, "%d", &choice); err != nil || choice < 1 || choice > len(verifyResp.Orgs) {
119-
return fmt.Errorf("invalid selection")
120-
}
121-
orgName = verifyResp.Orgs[choice-1].Name
109+
return fmt.Errorf("multiple organizations found. Use --org to specify one: %s", strings.Join(names, ", "))
122110
}
123111

124112
// Step 6: Create API key

0 commit comments

Comments
 (0)