bridge/gitlab: prompt only for user provided token

Amine Hilaly created

Change summary

bridge/gitlab/config.go | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)

Detailed changes

bridge/gitlab/config.go 🔗

@@ -66,7 +66,7 @@ func (*Gitlab) Configure(repo repository.RepoCommon, params core.BridgeParams) (
 	if params.Token != "" {
 		token = params.Token
 	} else {
-		token, err = promptTokenOptions(url)
+		token, err = promptToken()
 		if err != nil {
 			return nil, err
 		}
@@ -122,34 +122,6 @@ func requestToken(client *gitlab.Client, userID int, name string, scopes ...stri
 	return impToken.Token, nil
 }
 
-//TODO fix this
-func promptTokenOptions(url string) (string, error) {
-	for {
-		fmt.Println()
-		fmt.Println("[1]: user provided token")
-		fmt.Println("[2]: interactive token creation")
-		fmt.Print("Select option: ")
-
-		line, err := bufio.NewReader(os.Stdin).ReadString('\n')
-		fmt.Println()
-		if err != nil {
-			return "", err
-		}
-
-		line = strings.TrimRight(line, "\n")
-
-		index, err := strconv.Atoi(line)
-		if err != nil || (index != 1 && index != 2) {
-			fmt.Println("invalid input")
-			continue
-		}
-
-		if index == 1 {
-			return promptToken()
-		}
-	}
-}
-
 func promptToken() (string, error) {
 	fmt.Println("You can generate a new token by visiting https://gitlab.com/settings/tokens.")
 	fmt.Println("Choose 'Generate new token' and set the necessary access scope for your repository.")