|
1 | 1 | package cmd |
2 | 2 |
|
3 | 3 | import ( |
4 | | -"fmt" |
| 4 | + "fmt" |
5 | 5 |
|
6 | | -"github.com/aryansharma9917/codewise-cli/pkg/env" |
7 | | -"github.com/spf13/cobra" |
| 6 | + "github.com/aryansharma9917/codewise-cli/pkg/env" |
| 7 | + "github.com/spf13/cobra" |
8 | 8 | ) |
9 | 9 |
|
10 | 10 | var envListCmd = &cobra.Command{ |
11 | | -Use: "list", |
12 | | -Short: "List environments", |
13 | | -RunE: func(cmd *cobra.Command, args []string) error { |
14 | | -envs, err := env.ListEnvs() |
15 | | -if err != nil { |
16 | | -return LogError(err.Error()) |
17 | | -} |
| 11 | + Use: "list", |
| 12 | + Short: "List environments", |
| 13 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 14 | + envs, err := env.ListEnvs() |
| 15 | + if err != nil { |
| 16 | + return LogError(err.Error()) |
| 17 | + } |
18 | 18 |
|
19 | | -if len(envs) == 0 { |
20 | | -fmt.Println("no environments found") |
21 | | -return nil |
22 | | -} |
| 19 | + if len(envs) == 0 { |
| 20 | + fmt.Println("no environments found") |
| 21 | + return nil |
| 22 | + } |
23 | 23 |
|
24 | | -for _, e := range envs { |
25 | | -fmt.Printf("%-10s namespace=%s context=%s\n", |
26 | | -e.Name, e.K8s.Namespace, e.K8s.Context) |
27 | | -} |
28 | | -return nil |
29 | | -}, |
| 24 | + for _, e := range envs { |
| 25 | + fmt.Printf("%-10s namespace=%s context=%s\n", |
| 26 | + e.Name, e.K8s.Namespace, e.K8s.Context) |
| 27 | + } |
| 28 | + return nil |
| 29 | + }, |
30 | 30 | } |
31 | 31 |
|
32 | 32 | func init() { |
33 | | -envCmd.AddCommand(envListCmd) |
| 33 | + envCmd.AddCommand(envListCmd) |
34 | 34 | } |
0 commit comments