diff --git a/cmd/rekor-cli/app/log_proof.go b/cmd/rekor-cli/app/log_proof.go index c041abafb4e5b96f2428ba29a4751ae6e1feb6ba..05dc43184b95b3e2b6e003111b162c8b85da5b8a 100644 --- a/cmd/rekor-cli/app/log_proof.go +++ b/cmd/rekor-cli/app/log_proof.go @@ -55,15 +55,18 @@ var logProofCmd = &cobra.Command{ if err := viper.BindPFlags(cmd.Flags()); err != nil { return fmt.Errorf("Error initializing cmd line args: %s", err) } - if viper.GetUint64("first-size") > viper.GetUint64("last-size") { - return errors.New("last-size must be >= to first-size") - } if viper.GetUint64("first-size") == 0 { return errors.New("first-size must be > 0") } + if !viper.IsSet("last-size") { + return errors.New("last-size must be specified") + } if viper.GetUint64("last-size") == 0 { return errors.New("last-size must be > 0") } + if viper.GetUint64("first-size") > viper.GetUint64("last-size") { + return errors.New("last-size must be >= to first-size") + } return nil }, Run: format.WrapCmd(func(args []string) (interface{}, error) {