parent
dcd4f08b0c
commit
3797df7022
25
main.go
25
main.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -26,7 +27,18 @@ var (
|
||||||
"i": "ⓘ",
|
"i": "ⓘ",
|
||||||
"w": "⚠",
|
"w": "⚠",
|
||||||
}
|
}
|
||||||
supernums = "⁰¹²³⁴⁵⁶⁷⁸⁹"
|
supernums = map[int]string{
|
||||||
|
0: "⁰",
|
||||||
|
1: "¹",
|
||||||
|
2: "²",
|
||||||
|
3: "³",
|
||||||
|
4: "⁴",
|
||||||
|
5: "⁵",
|
||||||
|
6: "⁶",
|
||||||
|
7: "⁷",
|
||||||
|
8: "⁸",
|
||||||
|
9: "⁹",
|
||||||
|
}
|
||||||
refresh = time.Hour * 24 * 30
|
refresh = time.Hour * 24 * 30
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -143,12 +155,17 @@ func formatFeat(feat data, d Data, short bool) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !short {
|
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)
|
n, _ := strconv.Atoi(num)
|
||||||
if _, ok := needNote[n]; !ok {
|
if _, ok := needNote[n]; !ok {
|
||||||
continue
|
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 != "" {
|
if feat.Notes != "" {
|
||||||
out.WriteString(fmt.Sprintf("\t %s %s", resultmap["i"], replaceNoteRe.ReplaceAllString(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 {
|
if match != nil {
|
||||||
num, _ := strconv.Atoi(match[1])
|
num, _ := strconv.Atoi(match[1])
|
||||||
nums[num] = struct{}{}
|
nums[num] = struct{}{}
|
||||||
out.WriteString(string(supernums[num]))
|
out.WriteString(supernums[num])
|
||||||
}
|
}
|
||||||
if stat.usage > 0 {
|
if stat.usage > 0 {
|
||||||
str := out.String()
|
str := out.String()
|
||||||
|
|
Loading…
Reference in New Issue