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

Function List

scmintegrations/list.go:15–46  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

13)
14
15func List(ctx context.Context) error {
16 c, err := config.ScalingoAuthClient(ctx)
17 if err != nil {
18 return errors.Wrapf(ctx, err, "fail to get Scalingo client")
19 }
20
21 integrations, err := c.SCMIntegrationsList(ctx)
22 if err != nil {
23 return errors.Wrapf(ctx, err, "fail to list SCM integrations")
24 }
25
26 nbrIntegrations := len(integrations)
27 if nbrIntegrations == 0 {
28 io.Status("Your Scalingo account is not linked to any SCM integrations.")
29 return nil
30 }
31
32 pluralIntegration := ""
33 if nbrIntegrations > 1 {
34 pluralIntegration = "s"
35 }
36
37 io.Statusf("You already have %d SCM integration%s linked with your Scalingo account:\n", nbrIntegrations, pluralIntegration)
38
39 t := tablewriter.NewWriter(os.Stdout)
40 t.Header([]string{"ID", "Type", "URL", "Username", "Email"})
41 for _, i := range integrations {
42 t.Append([]string{i.ID, scalingo.SCMTypeDisplay[i.SCMType], i.URL, i.Username, i.Email})
43 }
44 t.Render()
45 return nil
46}

Callers 1

Calls 4

ScalingoAuthClientFunction · 0.92
StatusFunction · 0.92
StatusfFunction · 0.92
RenderMethod · 0.65

Tested by

no test coverage detected