diff --git a/src/go/rpk/pkg/adminapi/api_broker.go b/src/go/rpk/pkg/adminapi/api_broker.go index e5e54aa1234d2..f1340eb422357 100644 --- a/src/go/rpk/pkg/adminapi/api_broker.go +++ b/src/go/rpk/pkg/adminapi/api_broker.go @@ -87,7 +87,7 @@ type DecommissionStatusResponse struct { func (a *AdminAPI) Brokers(ctx context.Context) ([]Broker, error) { var bs []Broker defer func() { - sort.Slice(bs, func(i, j int) bool { return bs[i].NodeID < bs[j].NodeID }) //nolint:revive // return inside this deferred function is for the sort's less function + sort.Slice(bs, func(i, j int) bool { return bs[i].NodeID < bs[j].NodeID }) }() return bs, a.sendAny(ctx, http.MethodGet, brokersEndpoint, nil, &bs) } diff --git a/src/go/rpk/pkg/cli/cloud/byoc/byoc.go b/src/go/rpk/pkg/cli/cloud/byoc/byoc.go index 828553004ecba..8dbccd8d372a8 100644 --- a/src/go/rpk/pkg/cli/cloud/byoc/byoc.go +++ b/src/go/rpk/pkg/cli/cloud/byoc/byoc.go @@ -51,7 +51,10 @@ func init() { cmd.Run = func(cmd *cobra.Command, args []string) { cfg, redpandaID, pluginArgs, err := parseBYOCFlags(fs, p, cmd, args) out.MaybeDieErr(err) - + if cmd.Flags().Changed("help") { + cmd.Help() + return + } // --redpanda-id is only required in apply or destroy commands. // For validate commands we don't need the redpanda-id, instead, // we download the latest version always. @@ -170,7 +173,7 @@ and then come back to this command to complete the process. } } - if !isKnown || (redpandaID == "" && !isValidate) { + if !isKnown || (redpandaID == "" && !isValidate) || cmd.Flags().Changed("help") { cmd.Help() return } diff --git a/src/go/rpk/pkg/cli/security/user/update.go b/src/go/rpk/pkg/cli/security/user/update.go index b5735fbf02345..3454d0aa0694c 100644 --- a/src/go/rpk/pkg/cli/security/user/update.go +++ b/src/go/rpk/pkg/cli/security/user/update.go @@ -10,6 +10,7 @@ package user import ( + "fmt" "strings" "github.com/redpanda-data/redpanda/src/go/rpk/pkg/adminapi" @@ -22,7 +23,7 @@ import ( func newUpdateCommand(fs afero.Fs, p *config.Params) *cobra.Command { var newPass, mechanism string cmd := &cobra.Command{ - Use: "update [USER] --new-password [PW]", + Use: "update [USER] --new-password [PW] --mechanism [MECHANISM]", Short: "Update SASL user credentials", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { @@ -46,9 +47,11 @@ func newUpdateCommand(fs afero.Fs, p *config.Params) *cobra.Command { } cmd.Flags().StringVar(&newPass, "new-password", "", "New user's password.") - cmd.Flags().StringVar(&mechanism, "mechanism", adminapi.ScramSha256, "SASL mechanism to use for the user you are updating (scram-sha-256, scram-sha-512, case insensitive)") + cmd.Flags().StringVar(&mechanism, "mechanism", "", fmt.Sprintf("SASL mechanism to use for the user you are updating (%v, %v, case insensitive)", adminapi.ScramSha256, adminapi.ScramSha512)) cmd.MarkFlagRequired("new-password") cmd.MarkFlagRequired("mechanism") - + cmd.RegisterFlagCompletionFunc("mechanism", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { + return []string{adminapi.ScramSha256, adminapi.ScramSha512}, cobra.ShellCompDirectiveDefault + }) return cmd }