diff --git a/system/system_info.go b/system/system_info.go index f3dda46d..d255bde4 100644 --- a/system/system_info.go +++ b/system/system_info.go @@ -1,7 +1,10 @@ package system import ( + "os/exec" "strings" + + "github.com/senorprogrammer/wtf/wtf" ) type SystemInfo struct { @@ -10,9 +13,14 @@ type SystemInfo struct { BuildVersion string } -func NewSystemInfo(raw string) *SystemInfo { +func NewSystemInfo() *SystemInfo { m := make(map[string]string) + arg := []string{} + + cmd := exec.Command("sw_vers", arg...) + raw := wtf.ExecuteCommand(cmd) + for _, row := range strings.Split(raw, "\n") { parts := strings.Split(row, ":") diff --git a/system/widget.go b/system/widget.go index 0c934841..6024fc2d 100644 --- a/system/widget.go +++ b/system/widget.go @@ -2,7 +2,6 @@ package system import ( "fmt" - "os/exec" "time" "github.com/olebedev/config" @@ -28,7 +27,7 @@ func NewWidget(builtAt, version string) *Widget { Version: version, } - widget.buildSystemInfo() + widget.systemInfo = NewSystemInfo() return &widget } @@ -64,12 +63,3 @@ func (widget *Widget) prettyBuiltAt() string { return str.Format("Jan _2, 15:04") } } - -func (widget *Widget) buildSystemInfo() { - arg := []string{} - - cmd := exec.Command("sw_vers", arg...) - str := wtf.ExecuteCommand(cmd) - - widget.systemInfo = NewSystemInfo(str) -}