github.com/jcarley/cli@v0.0.0-20180201210820-966d90434c30/commands/git/list.go (about) 1 package git 2 3 import ( 4 "os/exec" 5 "strings" 6 ) 7 8 // List returns a list of all git removes in the current working directory. 9 func (g *SGit) List() ([]string, error) { 10 out, err := exec.Command("git", "remote").Output() 11 if err != nil { 12 return nil, err 13 } 14 remotes := []string{} 15 for _, r := range strings.Split(string(out), "\n") { 16 if len(strings.TrimSpace(r)) > 0 { 17 remotes = append(remotes, r) 18 } 19 } 20 return remotes, nil 21 }