Skip to content

Commit

Permalink
cobra.ExactArgs(0) -> cobra.NoArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Oct 29, 2024
1 parent 96d4da7 commit 99cc13f
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/clialert/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ cscli alerts delete --range 1.2.3.0/24
cscli alerts delete -s crowdsecurity/ssh-bf"`,
DisableAutoGenTag: true,
Aliases: []string{"remove"},
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 468 in cmd/crowdsec-cli/clialert/alerts.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clialert/alerts.go#L468

Added line #L468 was not covered by tests
PreRunE: func(cmd *cobra.Command, _ []string) error {
if deleteAll {
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/clibouncer/bouncers.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (cli *cliBouncers) newListCmd() *cobra.Command {
Use: "list",
Short: "list all bouncers within the database",
Example: `cscli bouncers list`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 201 in cmd/crowdsec-cli/clibouncer/bouncers.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clibouncer/bouncers.go#L201

Added line #L201 was not covered by tests
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, _ []string) error {
return cli.List(cmd.Context(), color.Output, cli.db)
Expand Down
4 changes: 2 additions & 2 deletions cmd/crowdsec-cli/clidecision/decisions.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ cscli decisions list -r 1.2.3.0/24
cscli decisions list -s crowdsecurity/ssh-bf
cscli decisions list --origin lists --scenario list_name
`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 293 in cmd/crowdsec-cli/clidecision/decisions.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clidecision/decisions.go#L293

Added line #L293 was not covered by tests
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, _ []string) error {
return cli.list(cmd.Context(), filter, NoSimu, contained, printMachine)
Expand Down Expand Up @@ -416,7 +416,7 @@ cscli decisions add --ip 1.2.3.4 --duration 24h --type captcha
cscli decisions add --scope username --value foobar
`,
/*TBD : fix long and example*/
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 419 in cmd/crowdsec-cli/clidecision/decisions.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clidecision/decisions.go#L419

Added line #L419 was not covered by tests
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, _ []string) error {
return cli.add(cmd.Context(), addIP, addRange, addDuration, addValue, addScope, addReason, addType)
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/cliexplain/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ cscli explain --log "Sep 19 18:33:22 scw-d95986 sshd[24347]: pam_unix(sshd:auth)
cscli explain --dsn "file://myfile.log" --type nginx
tail -n 5 myfile.log | cscli explain --type nginx -f -
`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 83 in cmd/crowdsec-cli/cliexplain/explain.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/cliexplain/explain.go#L83

Added line #L83 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
return cli.run()
Expand Down
10 changes: 5 additions & 5 deletions cmd/crowdsec-cli/clihub/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The Hub is managed by cscli, to get the latest hub files from [Crowdsec Hub](htt
Example: `cscli hub list
cscli hub update
cscli hub upgrade`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 42 in cmd/crowdsec-cli/clihub/hub.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clihub/hub.go#L42

Added line #L42 was not covered by tests
DisableAutoGenTag: true,
}

Expand Down Expand Up @@ -87,7 +87,7 @@ func (cli *cliHub) newListCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "list [-a]",
Short: "List all installed configurations",
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 90 in cmd/crowdsec-cli/clihub/hub.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clihub/hub.go#L90

Added line #L90 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
hub, err := require.Hub(cli.cfg(), nil, log.StandardLogger())
Expand Down Expand Up @@ -140,7 +140,7 @@ func (cli *cliHub) newUpdateCmd() *cobra.Command {
Long: `
Fetches the .index.json file from the hub, containing the list of available configs.
`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 143 in cmd/crowdsec-cli/clihub/hub.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clihub/hub.go#L143

Added line #L143 was not covered by tests
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, _ []string) error {
return cli.update(cmd.Context(), withContent)
Expand Down Expand Up @@ -190,7 +190,7 @@ func (cli *cliHub) newUpgradeCmd() *cobra.Command {
Long: `
Upgrade all configs installed from Crowdsec Hub. Run 'sudo cscli hub update' if you want the latest versions available.
`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 193 in cmd/crowdsec-cli/clihub/hub.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clihub/hub.go#L193

Added line #L193 was not covered by tests
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, _ []string) error {
return cli.upgrade(cmd.Context(), force)
Expand Down Expand Up @@ -235,7 +235,7 @@ func (cli *cliHub) newTypesCmd() *cobra.Command {
Long: `
List the types of supported hub items.
`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 238 in cmd/crowdsec-cli/clihub/hub.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clihub/hub.go#L238

Added line #L238 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
return cli.types()
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/clihubtest/hubtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (cli *cliHubTest) NewCommand() *cobra.Command {
Use: "hubtest",
Short: "Run functional tests on hub configurations",
Long: "Run functional tests on hub configurations (parsers, scenarios, collections...)",
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 42 in cmd/crowdsec-cli/clihubtest/hubtest.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clihubtest/hubtest.go#L42

Added line #L42 was not covered by tests
DisableAutoGenTag: true,
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
var err error
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/climetrics/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (cli *cliMetrics) newListCmd() *cobra.Command {
Use: "list",
Short: "List available types of metrics.",
Long: `List available types of metrics.`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 87 in cmd/crowdsec-cli/climetrics/list.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/climetrics/list.go#L87

Added line #L87 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
return cli.list()
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/climetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cscli metrics --url http://lapi.local:6060/metrics show acquisition parsers
# List available metric types
cscli metrics list`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 39 in cmd/crowdsec-cli/climetrics/metrics.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/climetrics/metrics.go#L39

Added line #L39 was not covered by tests
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, _ []string) error {
return cli.show(cmd.Context(), nil, url, noUnit)
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/clinotifications/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (cli *cliNotifications) newListCmd() *cobra.Command {
Short: "list notifications plugins",
Long: `list notifications plugins and their status (active or not)`,
Example: `cscli notifications list`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 161 in cmd/crowdsec-cli/clinotifications/notifications.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/clinotifications/notifications.go#L161

Added line #L161 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
cfg := cli.cfg()
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (cli *cliConfig) NewCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "config [command]",
Short: "Allows to view current config",
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 21 in cmd/crowdsec-cli/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/config.go#L21

Added line #L21 was not covered by tests
DisableAutoGenTag: true,
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/config_feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (cli *cliConfig) newFeatureFlagsCmd() *cobra.Command {
Use: "feature-flags",
Short: "Displays feature flag status",
Long: `Displays the supported feature flags and their current status.`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 124 in cmd/crowdsec-cli/config_feature_flags.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/config_feature_flags.go#L124

Added line #L124 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
return cli.featureFlags(showRetired)
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/config_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (cli *cliConfig) newShowCmd() *cobra.Command {
Use: "show",
Short: "Displays current config",
Long: `Displays the current cli configuration.`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 238 in cmd/crowdsec-cli/config_show.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/config_show.go#L238

Added line #L238 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
if err := cli.cfg().LoadAPIClient(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/config_showyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (cli *cliConfig) newShowYAMLCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "show-yaml",
Short: "Displays merged config.yaml + config.yaml.local",
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 18 in cmd/crowdsec-cli/config_showyaml.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/config_showyaml.go#L18

Added line #L18 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
return cli.showYAML()
Expand Down
10 changes: 5 additions & 5 deletions cmd/crowdsec-cli/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (cli *cliDashboard) newSetupCmd() *cobra.Command {
Use: "setup",
Short: "Setup a metabase container.",
Long: `Perform a metabase docker setup, download standard dashboards, create a fresh user and start the container`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 132 in cmd/crowdsec-cli/dashboard.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/dashboard.go#L132

Added line #L132 was not covered by tests
DisableAutoGenTag: true,
Example: `
cscli dashboard setup
Expand Down Expand Up @@ -198,7 +198,7 @@ func (cli *cliDashboard) newStartCmd() *cobra.Command {
Use: "start",
Short: "Start the metabase container.",
Long: `Stats the metabase container using docker.`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 201 in cmd/crowdsec-cli/dashboard.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/dashboard.go#L201

Added line #L201 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
mb, err := metabase.NewMetabase(metabaseConfigPath, metabaseContainerID)
Expand Down Expand Up @@ -229,7 +229,7 @@ func (cli *cliDashboard) newStopCmd() *cobra.Command {
Use: "stop",
Short: "Stops the metabase container.",
Long: `Stops the metabase container using docker.`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 232 in cmd/crowdsec-cli/dashboard.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/dashboard.go#L232

Added line #L232 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
if err := metabase.StopContainer(metabaseContainerID); err != nil {
Expand All @@ -245,7 +245,7 @@ func (cli *cliDashboard) newStopCmd() *cobra.Command {
func (cli *cliDashboard) newShowPasswordCmd() *cobra.Command {
cmd := &cobra.Command{Use: "show-password",
Short: "displays password of metabase.",
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 248 in cmd/crowdsec-cli/dashboard.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/dashboard.go#L248

Added line #L248 was not covered by tests
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, _ []string) error {
m := metabase.Metabase{}
Expand All @@ -268,7 +268,7 @@ func (cli *cliDashboard) newRemoveCmd() *cobra.Command {
Use: "remove",
Short: "removes the metabase container.",
Long: `removes the metabase container using docker.`,
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,

Check warning on line 271 in cmd/crowdsec-cli/dashboard.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec-cli/dashboard.go#L271

Added line #L271 was not covered by tests
DisableAutoGenTag: true,
Example: `
cscli dashboard remove
Expand Down

0 comments on commit 99cc13f

Please sign in to comment.