From 02659261052225c116c39da292c8eab67e6f9bbb Mon Sep 17 00:00:00 2001 From: Steven Gagniere Date: Fri, 5 Dec 2025 11:52:34 -0800 Subject: [PATCH] Update flag description --- internal/schema-registry/command_exporter.go | 7 ++++++- internal/schema-registry/command_exporter_create.go | 2 +- internal/schema-registry/command_exporter_update.go | 2 +- .../output/schema-registry/exporter/create-help.golden | 2 +- .../output/schema-registry/exporter/update-help.golden | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/schema-registry/command_exporter.go b/internal/schema-registry/command_exporter.go index 6c02dba97e..b38395f303 100644 --- a/internal/schema-registry/command_exporter.go +++ b/internal/schema-registry/command_exporter.go @@ -2,6 +2,7 @@ package schemaregistry import ( "fmt" + "slices" "github.com/spf13/cobra" @@ -32,8 +33,12 @@ func (c *command) newExporterCommand(cfg *config.Config) *cobra.Command { return cmd } -func addContextTypeFlag(cmd *cobra.Command) { +func addContextTypeFlag(cloud bool, cmd *cobra.Command) { arr := []string{"auto", "custom", "none"} + if cloud { + arr = append(arr, "default") + slices.Sort(arr) + } cmd.Flags().String("context-type", arr[0], fmt.Sprintf(`Exporter context type. One of %s.`, utils.ArrayToCommaDelimitedString(arr, "or"))) pcmd.RegisterFlagCompletionFunc(cmd, "context-type", func(_ *cobra.Command, _ []string) []string { return arr }) } diff --git a/internal/schema-registry/command_exporter_create.go b/internal/schema-registry/command_exporter_create.go index b8e3704b7e..f19df4c64b 100644 --- a/internal/schema-registry/command_exporter_create.go +++ b/internal/schema-registry/command_exporter_create.go @@ -38,7 +38,7 @@ func (c *command) newExporterCreateCommand(cfg *config.Config) *cobra.Command { pcmd.AddConfigFlag(cmd) cmd.Flags().StringSlice("subjects", []string{"*"}, "A comma-separated list of exporter subjects.") cmd.Flags().String("subject-format", "${subject}", "Exporter subject rename format. The format string can contain ${subject}, which will be replaced with the default subject name.") - addContextTypeFlag(cmd) + addContextTypeFlag(cfg.IsCloudLogin(), cmd) cmd.Flags().String("context-name", "", "Exporter context name.") pcmd.AddContextFlag(cmd, c.CLICommand) if cfg.IsCloudLogin() { diff --git a/internal/schema-registry/command_exporter_update.go b/internal/schema-registry/command_exporter_update.go index d12cb18dfd..e664beb4b7 100644 --- a/internal/schema-registry/command_exporter_update.go +++ b/internal/schema-registry/command_exporter_update.go @@ -41,7 +41,7 @@ func (c *command) newExporterUpdateCommand(cfg *config.Config) *cobra.Command { pcmd.AddConfigFlag(cmd) cmd.Flags().StringSlice("subjects", []string{}, "A comma-separated list of exporter subjects.") cmd.Flags().String("subject-format", "${subject}", "Exporter subject rename format. The format string can contain ${subject}, which will be replaced with the default subject name.") - addContextTypeFlag(cmd) + addContextTypeFlag(cfg.IsCloudLogin(), cmd) cmd.Flags().String("context-name", "", "Exporter context name.") pcmd.AddContextFlag(cmd, c.CLICommand) if cfg.IsCloudLogin() { diff --git a/test/fixtures/output/schema-registry/exporter/create-help.golden b/test/fixtures/output/schema-registry/exporter/create-help.golden index 0cd903ac86..feb420cbe2 100644 --- a/test/fixtures/output/schema-registry/exporter/create-help.golden +++ b/test/fixtures/output/schema-registry/exporter/create-help.golden @@ -12,7 +12,7 @@ Flags: --config strings A comma-separated list of "key=value" pairs, or path to a configuration file containing a newline-separated list of "key=value" pairs. --subjects strings A comma-separated list of exporter subjects. (default [*]) --subject-format string Exporter subject rename format. The format string can contain ${subject}, which will be replaced with the default subject name. (default "${subject}") - --context-type string Exporter context type. One of "auto", "custom", or "none". (default "auto") + --context-type string Exporter context type. One of "auto", "custom", "default", or "none". (default "auto") --context-name string Exporter context name. --context string CLI context name. --environment string Environment ID. diff --git a/test/fixtures/output/schema-registry/exporter/update-help.golden b/test/fixtures/output/schema-registry/exporter/update-help.golden index e11595618d..d8f2173b47 100644 --- a/test/fixtures/output/schema-registry/exporter/update-help.golden +++ b/test/fixtures/output/schema-registry/exporter/update-help.golden @@ -16,7 +16,7 @@ Flags: --config strings A comma-separated list of "key=value" pairs, or path to a configuration file containing a newline-separated list of "key=value" pairs. --subjects strings A comma-separated list of exporter subjects. --subject-format string Exporter subject rename format. The format string can contain ${subject}, which will be replaced with the default subject name. (default "${subject}") - --context-type string Exporter context type. One of "auto", "custom", or "none". (default "auto") + --context-type string Exporter context type. One of "auto", "custom", "default", or "none". (default "auto") --context-name string Exporter context name. --context string CLI context name. --environment string Environment ID.