aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github/config.go
diff options
context:
space:
mode:
authoramine <hilalyamine@gmail.com>2019-11-25 15:08:48 +0100
committeramine <hilalyamine@gmail.com>2019-11-25 15:08:48 +0100
commit7cb772095ef9fada1d07924eb4cba57550bba60d (patch)
tree0dc5249803274142dcf50469debab522ae5e6f27 /bridge/github/config.go
parent44f648a931b43d707d37cb469fead5e21a615e04 (diff)
downloadgit-bug-7cb772095ef9fada1d07924eb4cba57550bba60d.tar.gz
bridge: trim inputs during bridge configuration
Diffstat (limited to 'bridge/github/config.go')
-rw-r--r--bridge/github/config.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/bridge/github/config.go b/bridge/github/config.go
index 0fbbd5aa..f0403062 100644
--- a/bridge/github/config.go
+++ b/bridge/github/config.go
@@ -101,7 +101,7 @@ func (g *Github) 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 {
@@ -268,7 +268,7 @@ func promptTokenOptions(repo repository.RepoCommon, owner, project string) (*cor
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)+2 {
@@ -320,7 +320,7 @@ func promptToken() (string, error) {
return "", err
}
- token := strings.TrimRight(line, "\n")
+ token := strings.TrimSpace(line)
if re.MatchString(token) {
return token, nil
}
@@ -409,7 +409,7 @@ func promptUsername() (string, error) {
return "", err
}
- line = strings.TrimRight(line, "\n")
+ line = strings.TrimSpace(line)
ok, err := validateUsername(line)
if err != nil {
@@ -442,7 +442,7 @@ func promptURL(remotes map[string]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) {
@@ -470,7 +470,7 @@ func promptURL(remotes map[string]string) (string, string, error) {
return "", "", err
}
- line = strings.TrimRight(line, "\n")
+ line = strings.TrimSpace(line)
if line == "" {
fmt.Println("URL is empty")
continue
@@ -643,7 +643,7 @@ func promptProjectVisibility() (bool, error) {
return false, err
}
- line = strings.TrimRight(line, "\n")
+ line = strings.TrimSpace(line)
index, err := strconv.Atoi(line)
if err != nil || (index != 1 && index != 2) {