From 96643fd7468476ec0395b497458f535ecd1992b1 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Wed, 14 Jun 2023 16:59:57 +0200 Subject: [PATCH] Hide commands under preview from help output (#469) ## Changes TSIA Depends on https://github.com/databricks/databricks-sdk-go/pull/497. ## Tests Manually looked at the help output and no longer see the hidden commands. --- .codegen/service.go.tmpl | 23 ++++++++++++++----- cmd/account/access-control/access-control.go | 3 +++ cmd/account/budgets/budgets.go | 3 +++ cmd/workspace/connections/connections.go | 3 +++ cmd/workspace/metastores/metastores.go | 3 +++ .../system-schemas/system-schemas.go | 3 +++ cmd/workspace/volumes/volumes.go | 3 +++ 7 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.codegen/service.go.tmpl b/.codegen/service.go.tmpl index cdabd196..3ee67a7e 100644 --- a/.codegen/service.go.tmpl +++ b/.codegen/service.go.tmpl @@ -20,13 +20,18 @@ import ( {{define "service"}} var Cmd = &cobra.Command{ Use: "{{(.TrimPrefix "account").KebabName}}", - {{if .Description -}} - Short: `{{.Summary | without "`"}}`, + {{- if .Description }} + Short: `{{.Summary | without "`"}}`, Long: `{{.Comment " " 80 | without "`"}}`, - {{- end}} + {{- end }} Annotations: map[string]string{ "package": "{{ .Package.Name }}", }, + {{- if .IsPrivatePreview }} + + // This service is being previewed; hide from help output. + Hidden: true, + {{- end }} } {{- $serviceName := .KebabName -}} @@ -79,10 +84,16 @@ func init() { {{- $hasRequiredArgs := and (not $hasIdPrompt) $hasPosArgs -}} var {{.CamelName}}Cmd = &cobra.Command{ Use: "{{.KebabName}}{{if $hasPosArgs}}{{range .Request.RequiredFields}} {{.ConstantName}}{{end}}{{end}}", - {{if .Description -}} - Short: `{{.Summary | without "`"}}`, + {{- if .Description }} + Short: `{{.Summary | without "`"}}`, Long: `{{.Comment " " 80 | without "`"}}`, - {{end}} + {{- end }} + {{- if .IsPrivatePreview }} + + // This command is being previewed; hide from help output. + Hidden: true, + {{- end }} + Annotations: map[string]string{},{{if $hasRequiredArgs }} Args: func(cmd *cobra.Command, args []string) error { check := cobra.ExactArgs({{len .Request.RequiredFields}}) diff --git a/cmd/account/access-control/access-control.go b/cmd/account/access-control/access-control.go index 2ffa97bf..7e15696c 100755 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -21,6 +21,9 @@ var Cmd = &cobra.Command{ Annotations: map[string]string{ "package": "iam", }, + + // This service is being previewed; hide from help output. + Hidden: true, } // start get command diff --git a/cmd/account/budgets/budgets.go b/cmd/account/budgets/budgets.go index 0793228d..2c029010 100755 --- a/cmd/account/budgets/budgets.go +++ b/cmd/account/budgets/budgets.go @@ -20,6 +20,9 @@ var Cmd = &cobra.Command{ Annotations: map[string]string{ "package": "billing", }, + + // This service is being previewed; hide from help output. + Hidden: true, } // start create command diff --git a/cmd/workspace/connections/connections.go b/cmd/workspace/connections/connections.go index a585013b..9d9d76a7 100755 --- a/cmd/workspace/connections/connections.go +++ b/cmd/workspace/connections/connections.go @@ -29,6 +29,9 @@ var Cmd = &cobra.Command{ Annotations: map[string]string{ "package": "catalog", }, + + // This service is being previewed; hide from help output. + Hidden: true, } // start create command diff --git a/cmd/workspace/metastores/metastores.go b/cmd/workspace/metastores/metastores.go index b61974ee..cd0f0ced 100755 --- a/cmd/workspace/metastores/metastores.go +++ b/cmd/workspace/metastores/metastores.go @@ -333,6 +333,9 @@ var maintenanceCmd = &cobra.Command{ Enables or disables auto maintenance on the metastore.`, + // This command is being previewed; hide from help output. + Hidden: true, + Annotations: map[string]string{}, Args: func(cmd *cobra.Command, args []string) error { check := cobra.ExactArgs(2) diff --git a/cmd/workspace/system-schemas/system-schemas.go b/cmd/workspace/system-schemas/system-schemas.go index a8aa750f..db97e147 100755 --- a/cmd/workspace/system-schemas/system-schemas.go +++ b/cmd/workspace/system-schemas/system-schemas.go @@ -19,6 +19,9 @@ var Cmd = &cobra.Command{ Annotations: map[string]string{ "package": "catalog", }, + + // This service is being previewed; hide from help output. + Hidden: true, } // start disable command diff --git a/cmd/workspace/volumes/volumes.go b/cmd/workspace/volumes/volumes.go index d3b07399..f65f4ab4 100755 --- a/cmd/workspace/volumes/volumes.go +++ b/cmd/workspace/volumes/volumes.go @@ -26,6 +26,9 @@ var Cmd = &cobra.Command{ Annotations: map[string]string{ "package": "catalog", }, + + // This service is being previewed; hide from help output. + Hidden: true, } // start create command