aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/config.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-11-26 19:07:14 +0100
committerGitHub <noreply@github.com>2019-11-26 19:07:14 +0100
commit26a62692415868dab906bc702504e83532cb09b9 (patch)
tree0dc5249803274142dcf50469debab522ae5e6f27 /bridge/gitlab/config.go
parent44f648a931b43d707d37cb469fead5e21a615e04 (diff)
parent7cb772095ef9fada1d07924eb4cba57550bba60d (diff)
downloadgit-bug-26a62692415868dab906bc702504e83532cb09b9.tar.gz
Merge pull request #262 from MichaelMure/bridge
bridge: trim inputs during bridge configuration
Diffstat (limited to 'bridge/gitlab/config.go')
-rw-r--r--bridge/gitlab/config.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go
index 88ba7db8..5c6ccb0e 100644
--- a/bridge/gitlab/config.go
+++ b/bridge/gitlab/config.go
@@ -67,7 +67,7 @@ func (g *Gitlab) Configure(repo repository.RepoCommon, params core.BridgeParams)
if err != nil {
return nil, fmt.Errorf("reading from stdin: %v", err)
}
- token = strings.TrimSuffix(token, "\n")
+ token = strings.TrimSpace(token)
} else if params.TokenId != "" {
tokenId = entity.Id(params.TokenId)
} else {
@@ -154,7 +154,7 @@ func promptTokenOptions(repo repository.RepoCommon) (*core.Token, error) {
return nil, err
}
- line = strings.TrimRight(line, "\n")
+ line = strings.TrimSpace(line)
index, err := strconv.Atoi(line)
if err != nil || index < 1 || index > len(tokens)+1 {
fmt.Println("invalid input")
@@ -196,7 +196,7 @@ func promptToken() (string, error) {
return "", err
}
- token := strings.TrimRight(line, "\n")
+ token := strings.TrimSpace(line)
if re.MatchString(token) {
return token, nil
}
@@ -224,7 +224,7 @@ func promptURL(remotes map[string]string) (string, error) {
return "", err
}
- line = strings.TrimRight(line, "\n")
+ line = strings.TrimSpace(line)
index, err := strconv.Atoi(line)
if err != nil || index < 0 || index > len(validRemotes) {
@@ -250,7 +250,7 @@ func promptURL(remotes map[string]string) (string, error) {
return "", err
}
- url := strings.TrimRight(line, "\n")
+ url := strings.TrimSpace(line)
if line == "" {
fmt.Println("URL is empty")
continue