databricks-cli/cmd/workspace/warehouses/overrides.go

19 lines
631 B
Go

package warehouses
import (
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra"
)
func listOverride(listCmd *cobra.Command, listReq *sql.ListWarehousesRequest) {
listCmd.Annotations["template"] = cmdio.Heredoc(`
{{header "ID"}} {{header "Name"}} {{header "Size"}} {{header "State"}}
{{range .}}{{.Id|green}} {{.Name|cyan}} {{.ClusterSize|cyan}} {{if eq .State "RUNNING"}}{{"RUNNING"|green}}{{else if eq .State "STOPPED"}}{{"STOPPED"|red}}{{else}}{{blue "%s" .State}}{{end}}
{{end}}`)
}
func init() {
listOverrides = append(listOverrides, listOverride)
}