-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathoverrides.go
More file actions
35 lines (30 loc) · 1.02 KB
/
overrides.go
File metadata and controls
35 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package instance_pools
import (
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/tableview"
"github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra"
)
func listOverride(listCmd *cobra.Command) {
listCmd.Annotations["template"] = cmdio.Heredoc(`
{{range .}}{{.InstancePoolId|green}} {{.InstancePoolName}} {{.NodeTypeId}} {{.State}}
{{end}}`)
columns := []tableview.ColumnDef{
{Header: "Pool ID", Extract: func(v any) string {
return v.(compute.InstancePoolAndStats).InstancePoolId
}},
{Header: "Name", Extract: func(v any) string {
return v.(compute.InstancePoolAndStats).InstancePoolName
}},
{Header: "Node Type", Extract: func(v any) string {
return v.(compute.InstancePoolAndStats).NodeTypeId
}},
{Header: "State", Extract: func(v any) string {
return string(v.(compute.InstancePoolAndStats).State)
}},
}
tableview.RegisterConfig(listCmd, tableview.TableConfig{Columns: columns})
}
func init() {
listOverrides = append(listOverrides, listOverride)
}