go status moving here

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-26 02:02:56 -06:00
parent 2aed84cf3a
commit 9f26bc2d44
5 changed files with 25 additions and 10 deletions

View File

@ -124,11 +124,16 @@ func (rs *RepoStatus) drawGitStatus() {
rs.dirtyLabel = gadgets.NewOneLiner(newgrid, "dirty")
rs.readOnly = gadgets.NewOneLiner(newgrid, "read only")
rs.goSumStatus = gadgets.NewOneLiner(newgrid, "go mod status")
rs.speed = gadgets.NewOneLiner(newgrid, "refresh speed =")
rs.speedActual = gadgets.NewOneLiner(newgrid, "speed actual =")
}
func (rs *RepoStatus) SetGoSumStatus(s string) {
rs.goSumStatus.SetText(s)
}
func (rs *RepoStatus) drawGitCommands() {
rs.gitCommandsGroup = rs.window.Box().NewGroup("git commands")
newgrid := rs.gitCommandsGroup.NewGrid("gridnuts", 2, 2)

12
git.go
View File

@ -109,12 +109,12 @@ func (rs *RepoStatus) CheckDirty() bool {
rs.dirtyLabel.SetValue("no")
return false
}
log.Log(WARN, "CheckDirty() true", rs.realPath.String())
log.Log(WARN, "CheckDirty() cmd =", cmd)
log.Log(WARN, "CheckDirty() b =", b)
log.Log(WARN, "CheckDirty() path =", path)
log.Log(WARN, "CheckDirty() out =", out)
log.Log(WARN, "CheckDirty() err =", err)
log.Log(INFO, "CheckDirty() true", rs.realPath.String())
log.Log(INFO, "CheckDirty() cmd =", cmd)
log.Log(INFO, "CheckDirty() b =", b)
log.Log(INFO, "CheckDirty() path =", path)
log.Log(INFO, "CheckDirty() out =", out)
log.Log(INFO, "CheckDirty() err =", err)
rs.dirtyLabel.SetValue("dirty")
return true

View File

@ -364,6 +364,15 @@ func (rs *RepoStatus) CheckGoSum() (bool, string) {
log.Log(WARN, " NOT FOUND BUT IGNORING FOR NOW")
}
}
err, output := rs.RunCmd([]string{"git", "branch", "--remotes"})
if err == nil {
lines := strings.Split(output, "\n")
for i, s := range lines {
log.Log(WARN, "add line", i, s)
}
} else {
log.Log(WARN, "git branch --remotes failed", err)
}
return true, ""
}

View File

@ -17,8 +17,9 @@ type RepoStatus struct {
window *gadgets.BasicWindow
dirtyLabel *gadgets.OneLiner
readOnly *gadgets.OneLiner
dirtyLabel *gadgets.OneLiner
readOnly *gadgets.OneLiner
goSumStatus *gadgets.OneLiner
path *gadgets.OneLiner
goSrcPath *gadgets.OneLiner

View File

@ -222,13 +222,13 @@ func VerifyLocalGoRepo(gorepo string) bool {
// Form the path to the home Git directory
gitDir := filepath.Join(usr.HomeDir, "go/src/", gorepo, ".git")
log.Log(WARN, "VerifyLocalGoRepo() checking directory:", gitDir)
log.Log(INFO, "VerifyLocalGoRepo() checking directory:", gitDir)
if IsDirectory(gitDir) {
return true
}
goDir := filepath.Join(usr.HomeDir, "go/src/", gorepo)
gomod := goDir + "/go.mod"
log.Log(WARN, "VerifyLocalGoRepo() checking for go.mod :", gomod)
log.Log(INFO, "VerifyLocalGoRepo() checking for go.mod :", gomod)
_, err = os.Stat(gomod)
if os.IsNotExist(err) {
return false