diff --git a/cmd/syft/internal/commands/cataloger_info.go b/cmd/syft/internal/commands/cataloger_info.go index 1125ff344..007fd82b0 100644 --- a/cmd/syft/internal/commands/cataloger_info.go +++ b/cmd/syft/internal/commands/cataloger_info.go @@ -155,6 +155,14 @@ func renderCatalogerInfoJSON(doc *capabilities.Document, catalogers []capabiliti docOut := document{} + // sort catalogers by ecosystem then name + sort.Slice(catalogers, func(i, j int) bool { + if catalogers[i].Ecosystem != catalogers[j].Ecosystem { + return catalogers[i].Ecosystem < catalogers[j].Ecosystem + } + return catalogers[i].Name < catalogers[j].Name + }) + for _, cat := range catalogers { info := catalogerInfo{ Ecosystem: cat.Ecosystem,