From 6c02f0951da7962ccdcc50628887ef4eda2eb3b7 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Fri, 12 Jul 2019 17:37:49 +0200 Subject: bridge/gitlab: prompt only for user provided token --- bridge/gitlab/config.go | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'bridge/gitlab') diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go index 392452c6..7faddd6d 100644 --- a/bridge/gitlab/config.go +++ b/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.") -- cgit