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

Function List

projects/list.go:15–41  ·  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.ScalingoClient(ctx)
17 if err != nil {
18 return errors.Wrap(ctx, err, "get Scalingo client")
19 }
20
21 projects, err := c.ProjectsList(ctx)
22 if err != nil {
23 return errors.Wrap(ctx, err, "list projects")
24 }
25
26 io.Warning("This command only displays projects where you are the owner")
27
28 t := tablewriter.NewWriter(os.Stdout)
29 t.Header([]string{"Name", "Default", "ID", "Private Network"})
30
31 for _, project := range projects {
32 hasPrivateNetwork := ""
33 if project.Flags["private-network"] {
34 hasPrivateNetwork = "true"
35 }
36 _ = t.Append([]string{project.Name, strconv.FormatBool(project.Default), project.ID, hasPrivateNetwork})
37 }
38 _ = t.Render()
39
40 return nil
41}

Callers 1

projects.goFile · 0.92

Calls 3

ScalingoClientFunction · 0.92
WarningFunction · 0.92
RenderMethod · 0.65

Tested by

no test coverage detected