Skip to content

Commit

Permalink
rpk/cli: Remove silence usage at root level
Browse files Browse the repository at this point in the history
  • Loading branch information
r-vasquez committed Feb 8, 2022
1 parent 2beb1ba commit 719d2ac
Show file tree
Hide file tree
Showing 28 changed files with 37 additions and 171 deletions.
29 changes: 0 additions & 29 deletions src/go/rpk/pkg/cli/args.go

This file was deleted.

80 changes: 0 additions & 80 deletions src/go/rpk/pkg/cli/args_test.go

This file was deleted.

3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/acl.go
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli/cmd/acl"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli/cmd/common"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
Expand Down Expand Up @@ -43,7 +42,7 @@ func NewACLCommand(fs afero.Fs, mgr config.Manager) *cobra.Command {
Short: "Manage ACLs and SASL users.",
Long: helpACLs,
SilenceUsage: true,
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
if helpOperations {
fmt.Println(helpACLOperations)
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/acl/create.go
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/twmb/types"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/kafka"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
Expand Down Expand Up @@ -46,7 +45,7 @@ Allow write permissions to user buzz to transactional id "txn":
--allow-principal User:buzz --operation write --transactional-id txn
`,

Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/acl/delete.go
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/spf13/cobra"
"github.com/twmb/franz-go/pkg/kadm"
"github.com/twmb/types"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/kafka"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
Expand Down Expand Up @@ -55,7 +54,7 @@ resource names:
* "prefix" returns prefix patterns that match your input (prefix "fo" matches "foo")
* "literal" returns exact name matches
`,
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/acl/list.go
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/spf13/cobra"
"github.com/twmb/franz-go/pkg/kadm"
"github.com/twmb/types"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/kafka"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
Expand Down Expand Up @@ -49,7 +48,7 @@ resource names:
* "prefix" returns prefix patterns that match your input (prefix "fo" matches "foo")
* "literal" returns exact name matches
`,
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
5 changes: 2 additions & 3 deletions src/go/rpk/pkg/cli/cmd/acl/user.go
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/api/admin"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
)
Expand Down Expand Up @@ -77,7 +76,7 @@ ACLs to grant the account access to certain resources in your cluster. See the
acl help text for more info.
`,

Args: cli.MatchAll(cobra.MaximumNArgs(1)), // when the deprecated user flag is removed, change this to cobra.ExactArgs(1)
Args: cobra.MaximumNArgs(1), // when the deprecated user flag is removed, change this to cobra.ExactArgs(1)
Run: func(cmd *cobra.Command, args []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down Expand Up @@ -147,7 +146,7 @@ func NewDeleteUserCommand(fs afero.Fs) *cobra.Command {
This command deletes the specified SASL account from Redpanda. This does not
delete any ACLs that may exist for this user.
`,
Args: cli.MatchAll(cobra.MaximumNArgs(1)),
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/cluster/config/config.go
Expand Up @@ -12,7 +12,6 @@ package config
import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli/cmd/common"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
)
Expand All @@ -29,7 +28,7 @@ func NewConfigCommand(fs afero.Fs) *cobra.Command {

command := &cobra.Command{
Use: "config",
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Short: "Interact with cluster configuration properties.",
Long: `Interact with cluster configuration properties.
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/cluster/config/edit.go
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/api/admin"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
)
Expand All @@ -41,7 +40,7 @@ values.
By default, low level tunables are excluded: use the '--all' flag
to edit all properties including these tunables.
`,
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/debug/info.go
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/spf13/cobra"
"github.com/twmb/franz-go/pkg/kadm"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/api"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/kafka"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
Expand All @@ -38,7 +37,7 @@ func NewInfoCommand(fs afero.Fs) *cobra.Command {
Short: "Send usage stats to Vectorized.",
Hidden: true,
Aliases: []string{"status"},
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
if !send {
return
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/group/describe.go
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/twmb/franz-go/pkg/kadm"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/kafka"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
Expand All @@ -33,7 +32,7 @@ func NewDescribeCommand(fs afero.Fs) *cobra.Command {
This command describes group members, calculates their lag, and prints detailed
information about the members.
`,
Args: cli.MatchAll(cobra.MinimumNArgs(1)),
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, groups []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
7 changes: 3 additions & 4 deletions src/go/rpk/pkg/cli/cmd/group/group.go
Expand Up @@ -15,7 +15,6 @@ import (

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli/cmd/common"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/kafka"
Expand Down Expand Up @@ -67,7 +66,7 @@ deploy, and restart the members with a patch.
This command allows you to list all groups, describe a group (to view the
members and their lag), and manage offsets.
`,
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
}

var (
Expand Down Expand Up @@ -117,7 +116,7 @@ groups that have not yet expired. The BROKER column is which broker node is the
coordinator for the group. This command can be used to track down unknown
groups, or to list groups that need to be cleaned up.
`,
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down Expand Up @@ -165,7 +164,7 @@ You may want to delete groups to clean up offsets sooner than when they
automatically are cleaned up, such as when you create temporary groups for
quick investigation or testing. This command helps you do that.
`,
Args: cli.MatchAll(cobra.MinimumNArgs(1)),
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/group/seek.go
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/twmb/franz-go/pkg/kadm"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/config"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/kafka"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
Expand Down Expand Up @@ -83,7 +82,7 @@ Seek group G's topics foo, bar, and biz to the end:
Seek group G to the beginning of a topic it was not previously consuming:
rpk group seek G --to start --topics foo --allow-new-topics
`,
Args: cli.MatchAll(cobra.ExactArgs(1)),
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
p := config.ParamsFromCommand(cmd)
cfg, err := p.Load(fs)
Expand Down
9 changes: 4 additions & 5 deletions src/go/rpk/pkg/cli/cmd/plugin/plugin.go
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/out"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/plugin"
)
Expand Down Expand Up @@ -62,7 +61,7 @@ following:
where "path" is an underscore delimited argument path to a command. For
example, "foo_bar_baz" corresponds to the command "rpk foo bar baz".
`,
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
}
cmd.AddCommand(
newListCommand(fs),
Expand Down Expand Up @@ -90,7 +89,7 @@ You can specify --local to print all locally installed plugins, as well as
whether you have "shadowed" plugins (the same plugin specified multiple times).
`,

Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
Run: func(*cobra.Command, []string) {
installed := plugin.ListPlugins(fs, plugin.UserPaths())

Expand Down Expand Up @@ -164,7 +163,7 @@ An rpk plugin must be saved in a directory that is in your $PATH. By default,
this command installs plugins to the first directory in your $PATH. This can
be overridden by specifying the --bin-dir flag.
`,
Args: cli.MatchAll(cobra.ExactArgs(1)),
Args: cobra.ExactArgs(1),
Run: func(_ *cobra.Command, args []string) {
name := args[0]

Expand Down Expand Up @@ -256,7 +255,7 @@ matches the requested removal. If --include-shadowed is specified, this command
also removes all shadowed plugins of the same name.
`,

Args: cli.MatchAll(cobra.ExactArgs(1)),
Args: cobra.ExactArgs(1),

Run: func(_ *cobra.Command, args []string) {
name := args[0]
Expand Down
3 changes: 1 addition & 2 deletions src/go/rpk/pkg/cli/cmd/redpanda/admin/admin.go
Expand Up @@ -13,7 +13,6 @@ package admin
import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli/cmd/common"
"github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli/cmd/redpanda/admin/brokers"
configcmd "github.com/vectorizedio/redpanda/src/go/rpk/pkg/cli/cmd/redpanda/admin/config"
Expand All @@ -25,7 +24,7 @@ func NewCommand(fs afero.Fs) *cobra.Command {
cmd := &cobra.Command{
Use: "admin",
Short: "Talk to the Redpanda admin listener.",
Args: cli.MatchAll(cobra.ExactArgs(0)),
Args: cobra.ExactArgs(0),
}

var (
Expand Down

0 comments on commit 719d2ac

Please sign in to comment.