Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions _repoUtils/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,21 @@ func prettyPrintResults(data *map[string]int) {

func generateFile(dirStats *map[string]int) {
type Entry struct {
Topic string
Count int
Topic string
Count int
Percentage int
}

entries := make([]Entry, 0, len(*dirStats))
total := len(*dirStats)
entries := make([]Entry, 0, total)

for k, v := range *dirStats {
topic := strings.ReplaceAll(strings.Title(k), "-", " ")
entry := Entry{Topic: topic, Count: v}
entries = append(entries, entry)
}
sort.SliceStable(entries, func(i, j int) bool {
entries[i].Percentage = 5
return entries[i].Count > entries[j].Count
})

Expand Down