Skip to content

Commit

Permalink
rpk/cli: remove silence usage from commands
Browse files Browse the repository at this point in the history
  • Loading branch information
r-vasquez committed Feb 9, 2022
1 parent 719d2ac commit bd8d08d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 23 deletions.
9 changes: 4 additions & 5 deletions src/go/rpk/pkg/cli/cmd/acl.go
Expand Up @@ -38,11 +38,10 @@ func NewACLCommand(fs afero.Fs, mgr config.Manager) *cobra.Command {
helpOperations bool
)
command := &cobra.Command{
Use: "acl",
Short: "Manage ACLs and SASL users.",
Long: helpACLs,
SilenceUsage: true,
Args: cobra.ExactArgs(0),
Use: "acl",
Short: "Manage ACLs and SASL users.",
Long: helpACLs,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
if helpOperations {
fmt.Println(helpACLOperations)
Expand Down
1 change: 0 additions & 1 deletion src/go/rpk/pkg/cli/cmd/debug/bundle.go
Expand Up @@ -255,7 +255,6 @@ The following are the data sources that are bundled in the compressed file:
- dmidecode: The DMI table contents. Only included if this command is run
as root.
`,
SilenceUsage: true,
Run: func(cmd *cobra.Command, args []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
5 changes: 2 additions & 3 deletions src/go/rpk/pkg/cli/cmd/redpanda/check.go
Expand Up @@ -32,9 +32,8 @@ func NewCheckCommand(fs afero.Fs, mgr config.Manager) *cobra.Command {
timeout time.Duration
)
command := &cobra.Command{
Use: "check",
Short: "Check if system meets redpanda requirements.",
SilenceUsage: true,
Use: "check",
Short: "Check if system meets redpanda requirements.",
RunE: func(ccmd *cobra.Command, args []string) error {
return executeCheck(fs, mgr, configFile, timeout)
},
Expand Down
1 change: 0 additions & 1 deletion src/go/rpk/pkg/cli/cmd/redpanda/stop.go
Expand Up @@ -38,7 +38,6 @@ func NewStopCommand(fs afero.Fs, mgr config.Manager) *cobra.Command {
first sends SIGINT, and waits for the specified timeout. Then, if redpanda
hasn't stopped, it sends SIGTERM. Lastly, it sends SIGKILL if it's still
running.`,
SilenceUsage: true,
RunE: func(ccmd *cobra.Command, args []string) error {
return executeStop(fs, mgr, configFile, timeout)
},
Expand Down
5 changes: 0 additions & 5 deletions src/go/rpk/pkg/cli/cmd/root.go
Expand Up @@ -58,7 +58,6 @@ func Execute() {
Use: "rpk",
Short: "rpk is the Redpanda CLI & toolbox.",
Long: "",
Args: cobra.OnlyValidArgs,
}
rootCmd.PersistentFlags().BoolVarP(&verbose, config.FlagVerbose,
"v", false, "Enable verbose logging (default: false).")
Expand All @@ -74,10 +73,6 @@ func Execute() {

rootCmd.AddCommand(plugincmd.NewCommand(fs))

rootCmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
return fmt.Errorf("%v\n\n%v", err, cmd.UsageString())
})

addPlatformDependentCmds(fs, mgr, rootCmd)

// To support autocompletion even for plugins, we list all plugins now
Expand Down
7 changes: 3 additions & 4 deletions src/go/rpk/pkg/cli/cmd/version.go
Expand Up @@ -18,10 +18,9 @@ import (

func NewVersionCommand() *cobra.Command {
command := &cobra.Command{
Use: "version",
Short: "Check the current version.",
Long: "",
SilenceUsage: true,
Use: "version",
Short: "Check the current version.",
Long: "",
Run: func(_ *cobra.Command, _ []string) {
log.SetFormatter(cli.NewNoopFormatter())
log.Infof("%s\n", version.Pretty())
Expand Down
7 changes: 3 additions & 4 deletions src/go/rpk/pkg/cli/cmd/wasm/generate.go
Expand Up @@ -31,10 +31,9 @@ func NewGenerateCommand(fs afero.Fs) *cobra.Command {
skipVersion bool
)
cmd := &cobra.Command{
Use: "generate [PROJECT DIRECTORY]",
Short: "Create an npm template project for inline WASM engine.",
SilenceUsage: true,
Args: cobra.ExactArgs(1),
Use: "generate [PROJECT DIRECTORY]",
Short: "Create an npm template project for inline WASM engine.",
Args: cobra.ExactArgs(1),
Run: func(_ *cobra.Command, args []string) {
path, err := filepath.Abs(args[0])
out.MaybeDie(err, "unable to get absolute path for %q: %v", args[0], err)
Expand Down

0 comments on commit bd8d08d

Please sign in to comment.