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"}}
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}})

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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