abstract terminal interface

This commit is contained in:
alu
2026-08-07 14:49:21 -07:00
parent 691dba7687
commit 5c4d16857b
10 changed files with 91 additions and 40 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
package drivers
import (
"finally-a-monolithic-linux-hw-monitor/app/common"
"fmt"
"os"
"path/filepath"
@@ -17,18 +18,18 @@ func NewSysDriver() (*SysDriver, error) {
return &r, err
}
func (r *SysDriver) Render(console *strings.Builder) error {
fmt.Fprint(console, "--- Clock Frequency ---\033[K\n")
func (r *SysDriver) Render(term common.Terminal) error {
c, err := r.Read()
if err != nil {
return err
}
clock := c.([]ClockSensor)
term.Subheader("Frequency")
for _, sensor := range clock {
// \033[K clears from cursor to end of line (prevents lingering chars)
fmt.Fprintf(console, "%-16s | %.2f GHz\033[K\n", sensor.Name, sensor.FrequencyGHz)
term.Print(fmt.Sprintf("%-16s | %.2f GHz", sensor.Name, sensor.FrequencyGHz))
}
return nil