(ctx context.Context, dir string)
| 32 | } |
| 33 | |
| 34 | func ScalingoRepoAutoComplete(ctx context.Context, dir string) []string { |
| 35 | var repos []string |
| 36 | |
| 37 | remotes, err := ScalingoGitRemotes(ctx, dir) |
| 38 | if err != nil { |
| 39 | debug.Println("[detectCompletion] fail to get scalingo remotes in", dir) |
| 40 | return repos |
| 41 | } |
| 42 | |
| 43 | for _, remote := range remotes { |
| 44 | if strings.HasPrefix(remote.Config().Name, "scalingo-") { |
| 45 | repos = append(repos, remote.Config().Name[9:]) |
| 46 | } else { |
| 47 | repos = append(repos, remote.Config().Name) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | return repos |
| 52 | } |
| 53 | |
| 54 | // ScalingoGitRemotes returns an array of remote URLs (*.scalingo.com) from a git repository <directory> |
| 55 | func ScalingoGitRemotes(ctx context.Context, directory string) ([]*git.Remote, error) { |
no test coverage detected