diff --git a/cmd/rekor-cli/app/search.go b/cmd/rekor-cli/app/search.go index 2e7352589..8fbb96efc 100644 --- a/cmd/rekor-cli/app/search.go +++ b/cmd/rekor-cli/app/search.go @@ -44,14 +44,7 @@ type searchCmdOutput struct { } func (s *searchCmdOutput) String() string { - str := "No matching entries were found\n" - for i, uuid := range s.uuids { - if i == 0 { - str = "Found matching entries (listed by UUID):\n" - } - str += fmt.Sprintf("%v\n", uuid) - } - return str + return strings.Join(s.uuids, "\n") + "\n" // one extra /n to terminate the list } func addSearchPFlags(cmd *cobra.Command) error { @@ -203,6 +196,8 @@ var searchCmd = &cobra.Command{ return nil, fmt.Errorf("no matching entries found") } + fmt.Fprintln(os.Stderr, "Found matching entries (listed by UUID):") + return &searchCmdOutput{ uuids: resp.GetPayload(), }, nil