Skip to content

Commit

Permalink
✏️ aifalese 磁盘空间占用仅输出非0挂载点
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Dec 17, 2021
1 parent f202797 commit 3b637fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin_ai_false/ai_false.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ func diskPercent() string {
msg := ""
for _, p := range parts {
diskInfo, _ := disk.Usage(p.Mountpoint)
msg += fmt.Sprintf("\n - %s(%dM) %d%%", p.Mountpoint, diskInfo.Total/1024/1024, uint(math.Round(diskInfo.UsedPercent)))
pc := uint(math.Round(diskInfo.UsedPercent))
if pc > 0 {
msg += fmt.Sprintf("\n - %s(%dM) %d%%", p.Mountpoint, diskInfo.Total/1024/1024, pc)
}
}
return msg
}

0 comments on commit 3b637fa

Please sign in to comment.