-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathoverrides.go
More file actions
34 lines (29 loc) · 1.02 KB
/
overrides.go
File metadata and controls
34 lines (29 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
package external_locations
import (
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/tableview"
"github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra"
)
func listOverride(listCmd *cobra.Command, _ *catalog.ListExternalLocationsRequest) {
listCmd.Annotations["headerTemplate"] = cmdio.Heredoc(`
{{header "Name"}} {{header "Credential"}} {{header "URL"}}`)
listCmd.Annotations["template"] = cmdio.Heredoc(`
{{range .}}{{.Name|green}} {{.CredentialName|cyan}} {{.Url}}
{{end}}`)
columns := []tableview.ColumnDef{
{Header: "Name", Extract: func(v any) string {
return v.(catalog.ExternalLocationInfo).Name
}},
{Header: "Credential", Extract: func(v any) string {
return v.(catalog.ExternalLocationInfo).CredentialName
}},
{Header: "URL", Extract: func(v any) string {
return v.(catalog.ExternalLocationInfo).Url
}},
}
tableview.RegisterConfig(listCmd, tableview.TableConfig{Columns: columns})
}
func init() {
listOverrides = append(listOverrides, listOverride)
}