mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
SystemInfo struct is now master of its own domain
This commit is contained in:
parent
0ff65bbd5c
commit
89497561bc
@ -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, ":")
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user