@@ -11,7 +11,7 @@ import (
11
11
12
12
func makeResourceCmd () * cobra.Command {
13
13
cmd := & cobra.Command {
14
- Use : "resources" ,
14
+ Use : "resources" ,
15
15
Short : "manager Coder resources with platform-level context (users, organizations, environments)" ,
16
16
}
17
17
cmd .AddCommand (resourceTop )
@@ -54,8 +54,8 @@ var resourceTop = &cobra.Command{
54
54
55
55
tabwriter := tabwriter .NewWriter (os .Stdout , 0 , 0 , 4 , ' ' , 0 )
56
56
for _ , u := range users {
57
- _ , _ = fmt .Fprintf (tabwriter , "%s\t (%s)\t %s" , u .Name , u .Email , aggregateEnvResources (userEnvs [u .ID ]))
58
- if len (userEnvs [u .ID ]) > 0 {
57
+ _ , _ = fmt .Fprintf (tabwriter , "%s\t (%s)\t %s" , u .Name , u .Email , aggregateEnvResources (userEnvs [u .ID ]))
58
+ if len (userEnvs [u .ID ]) > 0 {
59
59
_ , _ = fmt .Fprintf (tabwriter , "\f " )
60
60
}
61
61
for _ , env := range userEnvs [u .ID ] {
@@ -71,19 +71,19 @@ var resourceTop = &cobra.Command{
71
71
}
72
72
73
73
func resourcesFromEnv (env coder.Environment ) resources {
74
- return resources {
75
- cpuAllocation : env .CPUCores ,
76
- cpuUtilization : env .LatestStat .CPUUsage ,
77
- memAllocation : env .MemoryGB ,
78
- memUtilization : env .LatestStat .MemoryUsage ,
79
- }
74
+ return resources {
75
+ cpuAllocation : env .CPUCores ,
76
+ cpuUtilization : env .LatestStat .CPUUsage ,
77
+ memAllocation : env .MemoryGB ,
78
+ memUtilization : env .LatestStat .MemoryUsage ,
79
+ }
80
80
}
81
81
82
82
func fmtEnvResources (env coder.Environment , orgs map [string ]coder.Org ) string {
83
- return fmt .Sprintf ("%s\t %s\t [org: %s]" , env .Name , resourcesFromEnv (env ), orgs [env .OrganizationID ].Name )
83
+ return fmt .Sprintf ("%s\t %s\t [org: %s]" , env .Name , resourcesFromEnv (env ), orgs [env .OrganizationID ].Name )
84
84
}
85
85
86
- func aggregateEnvResources (envs []coder.Environment ) ( resources ) {
86
+ func aggregateEnvResources (envs []coder.Environment ) resources {
87
87
var aggregate resources
88
88
for _ , e := range envs {
89
89
aggregate .cpuAllocation += e .CPUCores
0 commit comments