Skip to content

Commit

Permalink
Len args check
Browse files Browse the repository at this point in the history
  • Loading branch information
MissingNO57 committed Oct 3, 2024
1 parent ba89d00 commit 959f5dd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/fetchd/cmd/cudos_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,25 @@ func AddCudosFlags(startCmd *cobra.Command) {
startCmd.Flags().String(FlagCudosMigrationConfigPath, "", "Upgrade config file path. Required to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.")
startCmd.Flags().String(FlagCudosGenesisSha256, "", "Sha256 of the cudos genesis file. Optional to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.")
startCmd.Flags().String(FlagCudosMigrationConfigSha256, "", fmt.Sprintf("Sha256 of the upgrade config file. Required if to be provided *exclusively* during cudos migration upgrade node start and *only IF* \"%v\" flag has been provided, *ignored* on all subsequent node starts.", FlagCudosMigrationConfigPath))

// Capture the existing PreRunE function
existingPreRunE := startCmd.PreRunE

// Set a new PreRunE function that includes the old one
startCmd.PreRunE = func(cmd *cobra.Command, args []string) error {
// Check for positional arguments
if len(args) > 0 {
return fmt.Errorf("no positional arguments are allowed")
}

// Call the existing PreRunE function if it exists
if existingPreRunE != nil {
if err := existingPreRunE(cmd, args); err != nil {
return err
}
}

return nil
}

}

0 comments on commit 959f5dd

Please sign in to comment.