asf
This commit is contained in:
parent
07522043b4
commit
22c2f68c2a
3 changed files with 30 additions and 11 deletions
|
|
@ -457,12 +457,26 @@ func printCLIProject(action string, p Project) {
|
|||
}
|
||||
if p.RepoURL != "" {
|
||||
fmt.Printf("repo_url=%s\n", p.RepoURL)
|
||||
fmt.Printf("clone_url=%s\n", normalizeCloneURL(p.RepoURL))
|
||||
}
|
||||
if p.WebhookURL != "" {
|
||||
fmt.Printf("webhook_url=%s\n", p.WebhookURL)
|
||||
}
|
||||
}
|
||||
|
||||
func normalizeCloneURL(repoURL string) string {
|
||||
u := strings.TrimSpace(repoURL)
|
||||
if u == "" {
|
||||
return ""
|
||||
}
|
||||
if strings.HasPrefix(u, "http://") || strings.HasPrefix(u, "https://") {
|
||||
if !strings.HasSuffix(strings.ToLower(u), ".git") {
|
||||
return u + ".git"
|
||||
}
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func cliStatePath() string {
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil || home == "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue