(ctx context.Context)
| 13 | ) |
| 14 | |
| 15 | func 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 | } |
no test coverage detected