aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-07-12 17:37:49 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-07-23 17:18:04 +0200
commit6c02f0951da7962ccdcc50628887ef4eda2eb3b7 (patch)
tree142cce53177ca0953d721288211147fb5843677c
parentaea88180d3ccd6594d52f1489fd0a7ffc65ec178 (diff)
downloadgit-bug-6c02f0951da7962ccdcc50628887ef4eda2eb3b7.tar.gz
bridge/gitlab: prompt only for user provided token
-rw-r--r--bridge/gitlab/config.go30
1 files changed, 1 insertions, 29 deletions
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.")