Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added -ts argument to specify which (t)emperature (s)sensor to show the value for. Closes #8. #11

Merged
merged 7 commits into from
Nov 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add listTempSensors (-s) argument
  • Loading branch information
nwg-piotr committed Oct 18, 2024
commit 7389ad4ace3d4c09eafe56ba9f6191d800fa0580
13 changes: 13 additions & 0 deletions gopsuinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ func cpuAvSpeed(asIcon bool, delay *string) string {
return output
}

func listSensors() {
temps, _ := host.SensorsTemperatures()
for _, temp := range temps {
fmt.Printf("%s %v\n", temp.SensorKey, temp.Temperature)
}
os.Exit(0)
}

func temperatures(asIcon bool) string {
output := ""
if !asIcon {
Expand Down Expand Up @@ -213,6 +221,7 @@ func main() {
setPtr := flag.Bool("dark", false, "use (dark) icon set")
textPtr := flag.Bool("t", false, "Just (t)ext, no glyphs")
displayVersion := flag.Bool("v", false, "display (v)ersion information")
listTempSensors := flag.Bool("s", false, "list temperature (s)ensors")

flag.Parse()

Expand All @@ -221,6 +230,10 @@ func main() {
os.Exit(0)
}

if *listTempSensors {
listSensors()
}

if *textPtr {
g = glyphs{graphCPU: []rune("_▁▂▃▄▅▆▇███"), glyphCPU: "", glyphMem: "", glyphTemp: "", glyphUptime: ""}
} else {
Expand Down