Skip to content

Commit

Permalink
fix: only validate flags for the monitor and dump cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
marianozunino committed Nov 28, 2024
1 parent 7240cf3 commit f4766f4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ var RootCmd = &cobra.Command{
Long: logo + "\n\nThis application connects to a RabbitMQ server and dumps queue messages to a file.",

PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if err := validation.ValidateInput(); err != nil {
color.Red("Validation error: %v", err)
os.Exit(1)
switch cmd.Use {
case "dump", "monitor":
if err := validation.ValidateInput(); err != nil {
color.Red("Validation error: %v", err)
os.Exit(1)
}
}
return nil
},
Expand Down

0 comments on commit f4766f4

Please sign in to comment.