MCPcopy Create free account
hub / github.com/Scalingo/cli / ScalingoRepoAutoComplete

Function ScalingoRepoAutoComplete

utils/git.go:34–52  ·  view source on GitHub ↗
(ctx context.Context, dir string)

Source from the content-addressed store, hash-verified

32}
33
34func 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>
55func ScalingoGitRemotes(ctx context.Context, directory string) ([]*git.Remote, error) {

Callers 1

FlagRemoteAutoCompleteFunction · 0.92

Calls 1

ScalingoGitRemotesFunction · 0.85

Tested by

no test coverage detected