MCPcopy Index your code
hub / github.com/FloatTech/ZeroBot-Plugin / diskstate

Function diskstate

plugin/aifalse/main.go:657–679  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

655}
656
657func diskstate() (stateinfo []*status, err error) {
658 parts, err := disk.Partitions(false)
659 if err != nil {
660 return
661 }
662 stateinfo = make([]*status, 0, len(parts))
663 for _, v := range parts {
664 mp := v.Mountpoint
665 if strings.HasPrefix(mp, "/snap/") || strings.HasPrefix(mp, "/apex/") {
666 continue
667 }
668 diskusage, err := disk.Usage(mp)
669 if err != nil {
670 continue
671 }
672 stateinfo = append(stateinfo, &status{
673 precent: math.Round(diskusage.UsedPercent),
674 name: mp,
675 text: []string{storagefmt(float64(diskusage.Used)) + " / " + storagefmt(float64(diskusage.Total))},
676 })
677 }
678 return stateinfo, nil
679}
680
681func moreinfo(m *ctrl.Control[*zero.Ctx]) (stateinfo []*status, err error) {
682 var mems runtime.MemStats

Callers 1

drawstatusFunction · 0.85

Calls 1

storagefmtFunction · 0.85

Tested by

no test coverage detected