From 7da914ce00e6f026dc7c5120e36f3b9b9cfcafc5 Mon Sep 17 00:00:00 2001 From: Bob Callaway <bcallawa@redhat.com> Date: Wed, 31 Mar 2021 20:54:15 -0400 Subject: [PATCH] add checking to see if last-size has been set Signed-off-by: Bob Callaway <bcallawa@redhat.com> --- cmd/rekor-cli/app/log_proof.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/rekor-cli/app/log_proof.go b/cmd/rekor-cli/app/log_proof.go index c041aba..05dc431 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) { -- GitLab