Skip to content

Commit

Permalink
Add secondary sorting by name in frequency command
Browse files Browse the repository at this point in the history
  • Loading branch information
swiftyfinch committed Apr 7, 2024
1 parent 75ffdc4 commit 8a7cb38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/XTree/Core/Common/Services/FrequencyManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class FrequencyManager {
guard let maxFrequency = frequencies.map(\.value).max() else { return }
let width = Int(log10f(Float(maxFrequency)).rounded(.up))
let list = frequencies
.sorted { $0.value > $1.value }
.sorted { ($0.value, $1.key) > ($1.value, $0.key) }
.map { String(format: " %\(width)d ", $0.value).secondary + "\($0.key)".accent }
.joined(separator: "\n")
Swift.print(list)
Expand Down

0 comments on commit 8a7cb38

Please sign in to comment.