Skip to content

Commit

Permalink
sort classes
Browse files Browse the repository at this point in the history
  • Loading branch information
pquerna committed May 29, 2024
1 parent 457cf64 commit d63363d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions commands/schema_class_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"encoding/json"
"sort"

"github.com/spf13/cobra"
"github.com/valllabh/ocsf-tool/commons"
Expand Down Expand Up @@ -40,6 +41,10 @@ func runSchemaClassListCmd(cmd *cobra.Command, args []string) {
classesByCategory[class.Category] = append(classesByCategory[class.Category], class.Name)
}

for _, classes := range classesByCategory {
sort.Strings(classes)
}

if outputFilePath != "" {
contents, _ := json.Marshal(classesByCategory)
// Write classes by Category to output file
Expand Down

0 comments on commit d63363d

Please sign in to comment.