mirror of https://github.com/databricks/cli.git
Associate generated commands with command groups (#475)
## Changes With this change related commands show up next to each other in help output. The ordered list of groups is hard-coded until it can be derived from the specification. ## Tests Manually confirmed that the help output of the root command and the account command list commands by their groups.
This commit is contained in:
parent
b9406efd27
commit
c080fc67c9
|
@ -18,6 +18,13 @@ var accountCmd = &cobra.Command{
|
|||
|
||||
func init() {
|
||||
root.RootCmd.AddCommand(accountCmd)
|
||||
{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) }}
|
||||
accountCmd.AddCommand({{.SnakeName}}.Cmd){{end}}{{end}}{{end}}
|
||||
|
||||
{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
accountCmd.AddCommand({{.SnakeName}}.Cmd)
|
||||
{{end}}{{end}}{{end}}
|
||||
|
||||
// Register commands with groups
|
||||
{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
{{.SnakeName}}.Cmd.GroupID = "{{ .Package.Name }}"
|
||||
{{end}}{{end}}{{end}}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package cmd
|
||||
package workspace
|
||||
|
||||
{{$excludes := list "command-execution" "statement-execution" "dbfs" "dbsql-permissions"}}
|
||||
|
||||
|
@ -11,6 +11,12 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) }}
|
||||
root.RootCmd.AddCommand({{.SnakeName}}.Cmd){{end}}{{end}}{{end}}
|
||||
{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
root.RootCmd.AddCommand({{.SnakeName}}.Cmd)
|
||||
{{end}}{{end}}{{end}}
|
||||
|
||||
// Register commands with groups
|
||||
{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
{{.SnakeName}}.Cmd.GroupID = "{{ .Package.Name }}"
|
||||
{{end}}{{end}}{{end}}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,31 @@ func init() {
|
|||
accountCmd.AddCommand(vpc_endpoints.Cmd)
|
||||
accountCmd.AddCommand(workspace_assignment.Cmd)
|
||||
accountCmd.AddCommand(workspaces.Cmd)
|
||||
|
||||
// Register commands with groups
|
||||
account_access_control.Cmd.GroupID = "iam"
|
||||
billable_usage.Cmd.GroupID = "billing"
|
||||
budgets.Cmd.GroupID = "billing"
|
||||
credentials.Cmd.GroupID = "provisioning"
|
||||
custom_app_integration.Cmd.GroupID = "oauth2"
|
||||
encryption_keys.Cmd.GroupID = "provisioning"
|
||||
account_groups.Cmd.GroupID = "iam"
|
||||
account_ip_access_lists.Cmd.GroupID = "settings"
|
||||
log_delivery.Cmd.GroupID = "billing"
|
||||
account_metastore_assignments.Cmd.GroupID = "catalog"
|
||||
account_metastores.Cmd.GroupID = "catalog"
|
||||
networks.Cmd.GroupID = "provisioning"
|
||||
o_auth_enrollment.Cmd.GroupID = "oauth2"
|
||||
private_access.Cmd.GroupID = "provisioning"
|
||||
published_app_integration.Cmd.GroupID = "oauth2"
|
||||
service_principal_secrets.Cmd.GroupID = "oauth2"
|
||||
account_service_principals.Cmd.GroupID = "iam"
|
||||
account_settings.Cmd.GroupID = "settings"
|
||||
storage.Cmd.GroupID = "provisioning"
|
||||
account_storage_credentials.Cmd.GroupID = "catalog"
|
||||
account_users.Cmd.GroupID = "iam"
|
||||
vpc_endpoints.Cmd.GroupID = "provisioning"
|
||||
workspace_assignment.Cmd.GroupID = "iam"
|
||||
workspaces.Cmd.GroupID = "provisioning"
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package account
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
// Groups returns an ordered list of command groups.
|
||||
// The order matches the order used in the Databricks API explorer.
|
||||
func Groups() []cobra.Group {
|
||||
return []cobra.Group{
|
||||
{
|
||||
ID: "iam",
|
||||
Title: "Identity and Access Management",
|
||||
},
|
||||
{
|
||||
ID: "catalog",
|
||||
Title: "Unity Catalog",
|
||||
},
|
||||
{
|
||||
ID: "settings",
|
||||
Title: "Settings",
|
||||
},
|
||||
{
|
||||
ID: "provisioning",
|
||||
Title: "Provisioning",
|
||||
},
|
||||
{
|
||||
ID: "billing",
|
||||
Title: "Billing",
|
||||
},
|
||||
{
|
||||
ID: "oauth2",
|
||||
Title: "OAuth",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Register groups with parent command
|
||||
groups := Groups()
|
||||
for i := range groups {
|
||||
accountCmd.AddGroup(&groups[i])
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package cmd
|
||||
package workspace
|
||||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
|
@ -56,7 +56,6 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
|
||||
root.RootCmd.AddCommand(alerts.Cmd)
|
||||
root.RootCmd.AddCommand(catalogs.Cmd)
|
||||
root.RootCmd.AddCommand(cluster_policies.Cmd)
|
||||
|
@ -105,4 +104,55 @@ func init() {
|
|||
root.RootCmd.AddCommand(workspace.Cmd)
|
||||
root.RootCmd.AddCommand(workspace_bindings.Cmd)
|
||||
root.RootCmd.AddCommand(workspace_conf.Cmd)
|
||||
|
||||
// Register commands with groups
|
||||
alerts.Cmd.GroupID = "sql"
|
||||
catalogs.Cmd.GroupID = "catalog"
|
||||
cluster_policies.Cmd.GroupID = "compute"
|
||||
clusters.Cmd.GroupID = "compute"
|
||||
connections.Cmd.GroupID = "catalog"
|
||||
current_user.Cmd.GroupID = "iam"
|
||||
dashboards.Cmd.GroupID = "sql"
|
||||
data_sources.Cmd.GroupID = "sql"
|
||||
experiments.Cmd.GroupID = "ml"
|
||||
external_locations.Cmd.GroupID = "catalog"
|
||||
functions.Cmd.GroupID = "catalog"
|
||||
git_credentials.Cmd.GroupID = "workspace"
|
||||
global_init_scripts.Cmd.GroupID = "compute"
|
||||
grants.Cmd.GroupID = "catalog"
|
||||
groups.Cmd.GroupID = "iam"
|
||||
instance_pools.Cmd.GroupID = "compute"
|
||||
instance_profiles.Cmd.GroupID = "compute"
|
||||
ip_access_lists.Cmd.GroupID = "settings"
|
||||
jobs.Cmd.GroupID = "jobs"
|
||||
libraries.Cmd.GroupID = "compute"
|
||||
metastores.Cmd.GroupID = "catalog"
|
||||
model_registry.Cmd.GroupID = "ml"
|
||||
permissions.Cmd.GroupID = "iam"
|
||||
pipelines.Cmd.GroupID = "pipelines"
|
||||
policy_families.Cmd.GroupID = "compute"
|
||||
providers.Cmd.GroupID = "sharing"
|
||||
queries.Cmd.GroupID = "sql"
|
||||
query_history.Cmd.GroupID = "sql"
|
||||
recipient_activation.Cmd.GroupID = "sharing"
|
||||
recipients.Cmd.GroupID = "sharing"
|
||||
repos.Cmd.GroupID = "workspace"
|
||||
schemas.Cmd.GroupID = "catalog"
|
||||
secrets.Cmd.GroupID = "workspace"
|
||||
service_principals.Cmd.GroupID = "iam"
|
||||
serving_endpoints.Cmd.GroupID = "serving"
|
||||
shares.Cmd.GroupID = "sharing"
|
||||
storage_credentials.Cmd.GroupID = "catalog"
|
||||
system_schemas.Cmd.GroupID = "catalog"
|
||||
table_constraints.Cmd.GroupID = "catalog"
|
||||
tables.Cmd.GroupID = "catalog"
|
||||
token_management.Cmd.GroupID = "settings"
|
||||
tokens.Cmd.GroupID = "settings"
|
||||
users.Cmd.GroupID = "iam"
|
||||
volumes.Cmd.GroupID = "catalog"
|
||||
warehouses.Cmd.GroupID = "sql"
|
||||
workspace.Cmd.GroupID = "workspace"
|
||||
workspace_bindings.Cmd.GroupID = "catalog"
|
||||
workspace_conf.Cmd.GroupID = "settings"
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package workspace
|
||||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Groups returns an ordered list of command groups.
|
||||
// The order matches the order used in the Databricks API explorer.
|
||||
func Groups() []cobra.Group {
|
||||
return []cobra.Group{
|
||||
{
|
||||
ID: "workspace",
|
||||
Title: "Databricks Workspace",
|
||||
},
|
||||
{
|
||||
ID: "compute",
|
||||
Title: "Compute",
|
||||
},
|
||||
{
|
||||
ID: "jobs",
|
||||
Title: "Jobs",
|
||||
},
|
||||
{
|
||||
ID: "pipelines",
|
||||
Title: "Delta Live Tables",
|
||||
},
|
||||
{
|
||||
ID: "ml",
|
||||
Title: "Machine Learning",
|
||||
},
|
||||
{
|
||||
ID: "serving",
|
||||
Title: "Real-time Serving",
|
||||
},
|
||||
{
|
||||
ID: "iam",
|
||||
Title: "Identity and Access Management",
|
||||
},
|
||||
{
|
||||
ID: "sql",
|
||||
Title: "Databricks SQL",
|
||||
},
|
||||
{
|
||||
ID: "catalog",
|
||||
Title: "Unity Catalog",
|
||||
},
|
||||
{
|
||||
ID: "sharing",
|
||||
Title: "Delta Sharing",
|
||||
},
|
||||
{
|
||||
ID: "settings",
|
||||
Title: "Settings",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Register groups with parent command
|
||||
groups := Groups()
|
||||
for i := range groups {
|
||||
root.RootCmd.AddGroup(&groups[i])
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue