Don't hide commands of services that are already hidden (#1438)

## Changes

Currently, the help output of services in preview doesn't show any of
their commands because the commands themselves are hidden as well.

This change updates that behavior to not hide commands in preview if the
service itself is also in preview. This makes the help output of
services in preview actually usable.

## Tests

n/a
This commit is contained in:
Pieter Noordhuis 2024-05-17 11:02:30 +02:00 committed by GitHub
parent f7d4b272f4
commit 4556d33e6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 4 additions and 176 deletions

View File

@ -39,6 +39,7 @@ import (
{{define "service"}}
{{- $excludeMethods := list "put-secret" -}}
{{- $hideService := .IsPrivatePreview }}
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
@ -57,7 +58,7 @@ func New() *cobra.Command {
"package": "{{ .Package.Name }}",
},
{{- end }}
{{- if .IsPrivatePreview }}
{{- if $hideService }}
// This service is being previewed; hide from help output.
Hidden: true,
@ -190,7 +191,8 @@ func new{{.PascalName}}() *cobra.Command {
{{- end -}}
`
{{- end }}
{{- if .IsPrivatePreview }}
{{/* Don't hide commands if the service itself is already hidden. */}}
{{- if and (not $hideService) .IsPrivatePreview }}
// This command is being previewed; hide from help output.
cmd.Hidden = true

View File

@ -89,9 +89,6 @@ func newCreate() *cobra.Command {
characters and hyphens and be between 2 and 30 characters long. It must be
unique within the workspace.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -192,9 +189,6 @@ func newCreateDeployment() *cobra.Command {
APP_NAME: The name of the app.
SOURCE_CODE_PATH: The source code path of the deployment.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -288,9 +282,6 @@ func newDelete() *cobra.Command {
Arguments:
NAME: The name of the app.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -349,9 +340,6 @@ func newGet() *cobra.Command {
Arguments:
NAME: The name of the app.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -412,9 +400,6 @@ func newGetDeployment() *cobra.Command {
APP_NAME: The name of the app.
DEPLOYMENT_ID: The unique id of the deployment.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -474,9 +459,6 @@ func newGetEnvironment() *cobra.Command {
Arguments:
NAME: The name of the app.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -535,9 +517,6 @@ func newList() *cobra.Command {
Lists all apps in the workspace.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -594,9 +573,6 @@ func newListDeployments() *cobra.Command {
Arguments:
APP_NAME: The name of the app.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -652,9 +628,6 @@ func newStop() *cobra.Command {
Arguments:
NAME: The name of the app.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -719,9 +692,6 @@ func newUpdate() *cobra.Command {
characters and hyphens and be between 2 and 30 characters long. It must be
unique within the workspace.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -64,9 +64,6 @@ func newGet() *cobra.Command {
Get a high level preview of the metadata of listing installable content.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -126,9 +123,6 @@ func newList() *cobra.Command {
Personalized installations contain metadata about the attached share or git
repo, as well as the Delta Sharing recipient type.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -76,9 +76,6 @@ func newCreate() *cobra.Command {
Install payload associated with a Databricks Marketplace listing.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -140,9 +137,6 @@ func newDelete() *cobra.Command {
Uninstall an installation associated with a Databricks Marketplace listing.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -202,9 +196,6 @@ func newList() *cobra.Command {
List all installations across all listings.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -258,9 +249,6 @@ func newListListingInstallations() *cobra.Command {
List all installations for a particular listing.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -321,9 +309,6 @@ func newUpdate() *cobra.Command {
the rotateToken flag is true 2. the token will be forcibly rotate if the
rotateToken flag is true and the tokenInfo field is empty`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -66,9 +66,6 @@ func newGet() *cobra.Command {
Get a published listing in the Databricks Marketplace that the consumer has
access to.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -148,9 +145,6 @@ func newList() *cobra.Command {
List all published listings in the Databricks Marketplace that the consumer
has access to.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -215,9 +209,6 @@ func newSearch() *cobra.Command {
Arguments:
QUERY: Fuzzy matches query`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient

View File

@ -75,9 +75,6 @@ func newCreate() *cobra.Command {
Create a personalization request for a listing.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -142,9 +139,6 @@ func newGet() *cobra.Command {
Get the personalization request for a listing. Each consumer can make at
*most* one personalization request for a listing.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -203,9 +197,6 @@ func newList() *cobra.Command {
List personalization requests for a consumer across all listings.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -64,9 +64,6 @@ func newGet() *cobra.Command {
Get a provider in the Databricks Marketplace with at least one visible
listing.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -139,9 +136,6 @@ func newList() *cobra.Command {
List all providers in the Databricks Marketplace with at least one visible
listing.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -68,9 +68,6 @@ func newCreate() *cobra.Command {
Add an exchange filter.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -128,9 +125,6 @@ func newDelete() *cobra.Command {
Delete an exchange filter`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -201,9 +195,6 @@ func newList() *cobra.Command {
List exchange filter`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -258,9 +249,6 @@ func newUpdate() *cobra.Command {
Update an exchange filter.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -74,9 +74,6 @@ func newAddListingToExchange() *cobra.Command {
Associate an exchange with a listing`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -152,9 +149,6 @@ func newCreate() *cobra.Command {
Create an exchange`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -212,9 +206,6 @@ func newDelete() *cobra.Command {
This removes a listing from marketplace.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -270,9 +261,6 @@ func newDeleteListingFromExchange() *cobra.Command {
Disassociate an exchange with a listing`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -328,9 +316,6 @@ func newGet() *cobra.Command {
Get an exchange.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -389,9 +374,6 @@ func newList() *cobra.Command {
List exchanges visible to provider`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -445,9 +427,6 @@ func newListExchangesForListing() *cobra.Command {
List exchanges associated with a listing`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -503,9 +482,6 @@ func newListListingsForExchange() *cobra.Command {
List listings associated with an exchange`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -560,9 +536,6 @@ func newUpdate() *cobra.Command {
Update an exchange`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -72,9 +72,6 @@ func newCreate() *cobra.Command {
Create a file. Currently, only provider icons and attached notebooks are
supported.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -132,9 +129,6 @@ func newDelete() *cobra.Command {
Delete a file`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -202,9 +196,6 @@ func newGet() *cobra.Command {
Get a file`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -277,9 +268,6 @@ func newList() *cobra.Command {
List files attached to a parent entity.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient

View File

@ -70,9 +70,6 @@ func newCreate() *cobra.Command {
Create a new listing`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -130,9 +127,6 @@ func newDelete() *cobra.Command {
Delete a listing`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -200,9 +194,6 @@ func newGet() *cobra.Command {
Get a listing`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -273,9 +264,6 @@ func newList() *cobra.Command {
List listings owned by this provider`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -328,9 +316,6 @@ func newUpdate() *cobra.Command {
Update a listing`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -69,9 +69,6 @@ func newList() *cobra.Command {
List personalization requests to this provider. This will return all
personalization requests, regardless of which listing they are for.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -128,9 +125,6 @@ func newUpdate() *cobra.Command {
Update personalization request. This method only permits updating the status
of the request.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -60,9 +60,6 @@ func newCreate() *cobra.Command {
Create provider analytics dashboard. Returns Marketplace specific id. Not to
be confused with the Lakeview dashboard id.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -105,9 +102,6 @@ func newGet() *cobra.Command {
Get provider analytics dashboard.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -150,9 +144,6 @@ func newGetLatestVersion() *cobra.Command {
Get latest version of provider analytics dashboard.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -207,9 +198,6 @@ func newUpdate() *cobra.Command {
Arguments:
ID: id is immutable property and can't be updated.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {

View File

@ -69,9 +69,6 @@ func newCreate() *cobra.Command {
Create a provider`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -129,9 +126,6 @@ func newDelete() *cobra.Command {
Delete provider`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -199,9 +193,6 @@ func newGet() *cobra.Command {
Get provider profile`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
@ -272,9 +263,6 @@ func newList() *cobra.Command {
List provider profiles for account.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
@ -327,9 +315,6 @@ func newUpdate() *cobra.Command {
Update provider profile`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {