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.
This commit is contained in:
Pieter Noordhuis 2023-06-14 16:59:57 +02:00 committed by GitHub
parent 63437a6a98
commit 96643fd746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 6 deletions

View File

@ -20,13 +20,18 @@ import (
{{define "service"}} {{define "service"}}
var Cmd = &cobra.Command{ var Cmd = &cobra.Command{
Use: "{{(.TrimPrefix "account").KebabName}}", Use: "{{(.TrimPrefix "account").KebabName}}",
{{if .Description -}} {{- if .Description }}
Short: `{{.Summary | without "`"}}`, Short: `{{.Summary | without "`"}}`,
Long: `{{.Comment " " 80 | without "`"}}`, Long: `{{.Comment " " 80 | without "`"}}`,
{{- end}} {{- end }}
Annotations: map[string]string{ Annotations: map[string]string{
"package": "{{ .Package.Name }}", "package": "{{ .Package.Name }}",
}, },
{{- if .IsPrivatePreview }}
// This service is being previewed; hide from help output.
Hidden: true,
{{- end }}
} }
{{- $serviceName := .KebabName -}} {{- $serviceName := .KebabName -}}
@ -79,10 +84,16 @@ func init() {
{{- $hasRequiredArgs := and (not $hasIdPrompt) $hasPosArgs -}} {{- $hasRequiredArgs := and (not $hasIdPrompt) $hasPosArgs -}}
var {{.CamelName}}Cmd = &cobra.Command{ var {{.CamelName}}Cmd = &cobra.Command{
Use: "{{.KebabName}}{{if $hasPosArgs}}{{range .Request.RequiredFields}} {{.ConstantName}}{{end}}{{end}}", Use: "{{.KebabName}}{{if $hasPosArgs}}{{range .Request.RequiredFields}} {{.ConstantName}}{{end}}{{end}}",
{{if .Description -}} {{- if .Description }}
Short: `{{.Summary | without "`"}}`, Short: `{{.Summary | without "`"}}`,
Long: `{{.Comment " " 80 | 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 }} Annotations: map[string]string{},{{if $hasRequiredArgs }}
Args: func(cmd *cobra.Command, args []string) error { Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs({{len .Request.RequiredFields}}) check := cobra.ExactArgs({{len .Request.RequiredFields}})

View File

@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
Annotations: map[string]string{ Annotations: map[string]string{
"package": "iam", "package": "iam",
}, },
// This service is being previewed; hide from help output.
Hidden: true,
} }
// start get command // start get command

View File

@ -20,6 +20,9 @@ var Cmd = &cobra.Command{
Annotations: map[string]string{ Annotations: map[string]string{
"package": "billing", "package": "billing",
}, },
// This service is being previewed; hide from help output.
Hidden: true,
} }
// start create command // start create command

View File

@ -29,6 +29,9 @@ var Cmd = &cobra.Command{
Annotations: map[string]string{ Annotations: map[string]string{
"package": "catalog", "package": "catalog",
}, },
// This service is being previewed; hide from help output.
Hidden: true,
} }
// start create command // start create command

View File

@ -333,6 +333,9 @@ var maintenanceCmd = &cobra.Command{
Enables or disables auto maintenance on the metastore.`, Enables or disables auto maintenance on the metastore.`,
// This command is being previewed; hide from help output.
Hidden: true,
Annotations: map[string]string{}, Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error { Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2) check := cobra.ExactArgs(2)

View File

@ -19,6 +19,9 @@ var Cmd = &cobra.Command{
Annotations: map[string]string{ Annotations: map[string]string{
"package": "catalog", "package": "catalog",
}, },
// This service is being previewed; hide from help output.
Hidden: true,
} }
// start disable command // start disable command

View File

@ -26,6 +26,9 @@ var Cmd = &cobra.Command{
Annotations: map[string]string{ Annotations: map[string]string{
"package": "catalog", "package": "catalog",
}, },
// This service is being previewed; hide from help output.
Hidden: true,
} }
// start create command // start create command