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

@@ -5,7 +5,7 @@ import (
"os/exec"
"strings"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/utils"
)
type GitRepo struct {
@@ -33,7 +33,7 @@ func (repo *GitRepo) branch() string {
arg := []string{repo.gitDir(), repo.workTree(), "rev-parse", "--abbrev-ref", "HEAD"}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
str := utils.ExecuteCommand(cmd)
return str
}
@@ -42,7 +42,7 @@ func (repo *GitRepo) changedFiles() []string {
arg := []string{repo.gitDir(), repo.workTree(), "status", "--porcelain"}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
str := utils.ExecuteCommand(cmd)
data := strings.Split(str, "\n")
@@ -57,7 +57,7 @@ func (repo *GitRepo) commits(commitCount int, commitFormat, dateFormat string) [
arg := []string{repo.gitDir(), repo.workTree(), "log", dateStr, numStr, commitStr}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
str := utils.ExecuteCommand(cmd)
data := strings.Split(str, "\n")
@@ -67,21 +67,21 @@ func (repo *GitRepo) commits(commitCount int, commitFormat, dateFormat string) [
func (repo *GitRepo) repository() string {
arg := []string{repo.gitDir(), repo.workTree(), "rev-parse", "--show-toplevel"}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
str := utils.ExecuteCommand(cmd)
return str
}
func (repo *GitRepo) pull() string {
arg := []string{repo.gitDir(), repo.workTree(), "pull"}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
str := utils.ExecuteCommand(cmd)
return str
}
func (repo *GitRepo) checkout(branch string) string {
arg := []string{repo.gitDir(), repo.workTree(), "checkout", branch}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
str := utils.ExecuteCommand(cmd)
return str
}

View File

@@ -8,8 +8,8 @@ import (
"github.com/gdamore/tcell"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/utils"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
const offscreen = -1000
@@ -76,7 +76,7 @@ func (widget *Widget) Pull() {
}
func (widget *Widget) Refresh() {
repoPaths := wtf.ToStrs(widget.settings.repositories)
repoPaths := utils.ToStrs(widget.settings.repositories)
widget.GitRepos = widget.gitRepos(repoPaths)
sort.Slice(widget.GitRepos, func(i, j int) bool {