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:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user