Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/schema-registry/command_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package schemaregistry

import (
"fmt"
"slices"

"github.com/spf13/cobra"

Expand Down Expand Up @@ -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 })
}
2 changes: 1 addition & 1 deletion internal/schema-registry/command_exporter_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion internal/schema-registry/command_exporter_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down