Skip to content

Commit

Permalink
cscli refactor: method ccliSetup.validate()
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Jun 12, 2024
1 parent 2499fcb commit d80674e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/crowdsec-cli/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ func (cli *cliSetup) NewValidateCmd() *cobra.Command {
Short: "validate a setup file",
Args: cobra.ExactArgs(1),
DisableAutoGenTag: true,
RunE: runSetupValidate,
RunE: func(cmd *cobra.Command, args []string) error {
return cli.validate(args[0])
},
}

return cmd
Expand Down Expand Up @@ -287,9 +289,7 @@ func (cli *cliSetup) install(ctx context.Context, dryRun bool, fromFile string)
return setup.InstallHubItems(ctx, hub, input, dryRun)
}

func runSetupValidate(cmd *cobra.Command, args []string) error {
fromFile := args[0]

func (cli *cliSetup) validate(fromFile string) error {
input, err := os.ReadFile(fromFile)
if err != nil {
return fmt.Errorf("while reading stdin: %w", err)
Expand Down

0 comments on commit d80674e

Please sign in to comment.