-
Notifications
You must be signed in to change notification settings - Fork 1
/
truefetch_plan9.go
51 lines (42 loc) · 936 Bytes
/
truefetch_plan9.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//go:build plan9
// Plan9 specific instructions that are used to fetch system information in [truefetch](https://github.com/peajack/truefetch)
// thanks diplomat
package main
import (
"os"
"os/exec"
"strings"
)
const (
RESET = ""
)
func getShell() string {
return "rc"
}
func getUptime() string {
cmd := exec.Command("uptime")
stdout, err := cmd.Output()
if err != nil {
return ""
}
uptime := strings.ReplaceAll(string(stdout), "\n", "")
fields := strings.Fields(uptime)
return strings.Join(fields[2:], " ")
}
func getMemory() string {
return "N/A"
}
func getKernel() string {
filePath := "/dev/osversion"
contentBytes, err := os.ReadFile(filePath)
if err != nil {
return "" // Here, we shouldn't handle the error. But it SHOULD BE handled in Unix. This Function should return an error type
}
return string(contentBytes)
}
func getInit() string {
return ""
}
func getPkgs(_ string) string {
return ""
}