Skip to content

Commit

Permalink
Don't hide commands of services that are already hidden (#1438)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
pietern authored May 17, 2024
1 parent f7d4b27 commit 4556d33
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 176 deletions.
6 changes: 4 additions & 2 deletions .codegen/service.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
30 changes: 0 additions & 30 deletions cmd/workspace/apps/apps.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions cmd/workspace/consumer-fulfillments/consumer-fulfillments.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions cmd/workspace/consumer-installations/consumer-installations.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions cmd/workspace/consumer-listings/consumer-listings.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions cmd/workspace/consumer-providers/consumer-providers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4556d33

Please sign in to comment.