diff --git a/main.go b/main.go index fa614c0..38af3d5 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "regexp" + "sort" "strconv" "strings" "time" @@ -26,8 +27,19 @@ var ( "i": "ⓘ", "w": "⚠", } - supernums = "⁰¹²³⁴⁵⁶⁷⁸⁹" - refresh = time.Hour * 24 * 30 + supernums = map[int]string{ + 0: "⁰", + 1: "¹", + 2: "²", + 3: "³", + 4: "⁴", + 5: "⁵", + 6: "⁶", + 7: "⁷", + 8: "⁸", + 9: "⁹", + } + refresh = time.Hour * 24 * 30 ) func main() { @@ -143,12 +155,17 @@ func formatFeat(feat data, d Data, short bool) string { } if !short { - for num, note := range feat.NotesByNum { + nums := make([]string, 0, len(feat.NotesByNum)) + for num := range feat.NotesByNum { + nums = append(nums, num) + } + sort.Strings(nums) + for _, num := range nums { n, _ := strconv.Atoi(num) if _, ok := needNote[n]; !ok { continue } - out.WriteString(fmt.Sprintf("\t\t%s%s\n", color.YellowString(string(supernums[n])), note)) + out.WriteString(fmt.Sprintf("\t\t%s%s\n", color.YellowString(supernums[n]), feat.NotesByNum[num])) } if feat.Notes != "" { out.WriteString(fmt.Sprintf("\t %s %s", resultmap["i"], replaceNoteRe.ReplaceAllString(feat.Notes, " "))) @@ -180,7 +197,7 @@ func makeResult(stat browserStat, nums map[int]struct{}) string { if match != nil { num, _ := strconv.Atoi(match[1]) nums[num] = struct{}{} - out.WriteString(string(supernums[num])) + out.WriteString(supernums[num]) } if stat.usage > 0 { str := out.String()