36 lines
708 B
Go
36 lines
708 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"code.db.cafe/pauloo27/f/fetch"
|
|
)
|
|
|
|
func main() {
|
|
memory := must(fetch.Memory)
|
|
os := must(fetch.Os)
|
|
|
|
row(UserIcon, "user", must(fetch.User)+"@"+must(fetch.Hostname))
|
|
|
|
row(getOsIcon(os), "os", os)
|
|
|
|
row(KernelIcon, "kernel", must(fetch.Kernel))
|
|
|
|
row(UptimeIcon, "uptime", must(fetch.Uptime).String())
|
|
|
|
if strings.ToLower(os) == "arch linux" {
|
|
pkgs := must(fetch.Pkgs)
|
|
row(PkgsIcon, "pkgs",
|
|
conditional(pkgs.AvailableUpdates == 0,
|
|
fmt.Sprintf("%d", pkgs.Installed),
|
|
fmt.Sprintf("%d (%d upgradable)", pkgs.Installed, pkgs.AvailableUpdates),
|
|
),
|
|
)
|
|
}
|
|
|
|
row(MemoryIcon, "memory", fmt.Sprintf("%d / %d MiB", memory.Used, memory.Total))
|
|
|
|
show()
|
|
}
|