1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Move the utils.go file into the /utils directory

This commit is contained in:
Chris Cummer
2019-08-05 10:50:12 -07:00
parent 0bd2d176d8
commit 4e46fff145
57 changed files with 190 additions and 188 deletions

View File

@@ -9,7 +9,7 @@ import (
"strconv"
"strings"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/utils"
)
const TimeRegExp = "^(?:\\d|[01]\\d|2[0-3]):[0-5]\\d"
@@ -47,7 +47,7 @@ func (battery *Battery) String() string {
func (battery *Battery) execute() string {
cmd := exec.Command(battery.cmd, battery.args...)
return wtf.ExecuteCommand(cmd)
return utils.ExecuteCommand(cmd)
}
func (battery *Battery) parse(data string) string {

View File

@@ -8,7 +8,7 @@ import (
"strconv"
"strings"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/utils"
)
var batteryState string
@@ -41,7 +41,7 @@ func (battery *Battery) String() string {
func (battery *Battery) execute() string {
cmd := exec.Command("upower", "-e")
lines := strings.Split(wtf.ExecuteCommand(cmd), "\n")
lines := strings.Split(utils.ExecuteCommand(cmd), "\n")
var target string
for _, l := range lines {
if strings.Contains(l, "/battery") {
@@ -50,7 +50,7 @@ func (battery *Battery) execute() string {
}
}
cmd = exec.Command("upower", "-i", target)
return wtf.ExecuteCommand(cmd)
return utils.ExecuteCommand(cmd)
}
func (battery *Battery) parse(data string) string {

View File

@@ -7,7 +7,7 @@ import (
"regexp"
"strings"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/utils"
)
const SingleQuotesRegExp = "'(.*)'"
@@ -16,7 +16,7 @@ const SingleQuotesRegExp = "'(.*)'"
// "AC Power" or "Battery Power"
func powerSource() string {
cmd := exec.Command("pmset", []string{"-g", "ps"}...)
result := wtf.ExecuteCommand(cmd)
result := utils.ExecuteCommand(cmd)
r, _ := regexp.Compile(SingleQuotesRegExp)