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.dirtyLabel = gadgets.NewOneLiner(newgrid, "dirty")
rs.readOnly = gadgets.NewOneLiner(newgrid, "read only") rs.readOnly = gadgets.NewOneLiner(newgrid, "read only")
rs.goSumStatus = gadgets.NewOneLiner(newgrid, "go mod status")
rs.speed = gadgets.NewOneLiner(newgrid, "refresh speed =") rs.speed = gadgets.NewOneLiner(newgrid, "refresh speed =")
rs.speedActual = gadgets.NewOneLiner(newgrid, "speed actual =") rs.speedActual = gadgets.NewOneLiner(newgrid, "speed actual =")
} }
func (rs *RepoStatus) SetGoSumStatus(s string) {
rs.goSumStatus.SetText(s)
}
func (rs *RepoStatus) drawGitCommands() { func (rs *RepoStatus) drawGitCommands() {
rs.gitCommandsGroup = rs.window.Box().NewGroup("git commands") rs.gitCommandsGroup = rs.window.Box().NewGroup("git commands")
newgrid := rs.gitCommandsGroup.NewGrid("gridnuts", 2, 2) 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") rs.dirtyLabel.SetValue("no")
return false return false
} }
log.Log(WARN, "CheckDirty() true", rs.realPath.String()) log.Log(INFO, "CheckDirty() true", rs.realPath.String())
log.Log(WARN, "CheckDirty() cmd =", cmd) log.Log(INFO, "CheckDirty() cmd =", cmd)
log.Log(WARN, "CheckDirty() b =", b) log.Log(INFO, "CheckDirty() b =", b)
log.Log(WARN, "CheckDirty() path =", path) log.Log(INFO, "CheckDirty() path =", path)
log.Log(WARN, "CheckDirty() out =", out) log.Log(INFO, "CheckDirty() out =", out)
log.Log(WARN, "CheckDirty() err =", err) log.Log(INFO, "CheckDirty() err =", err)
rs.dirtyLabel.SetValue("dirty") rs.dirtyLabel.SetValue("dirty")
return true return true

View File

@ -364,6 +364,15 @@ func (rs *RepoStatus) CheckGoSum() (bool, string) {
log.Log(WARN, " NOT FOUND BUT IGNORING FOR NOW") 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, "" return true, ""
} }

View File

@ -19,6 +19,7 @@ type RepoStatus struct {
dirtyLabel *gadgets.OneLiner dirtyLabel *gadgets.OneLiner
readOnly *gadgets.OneLiner readOnly *gadgets.OneLiner
goSumStatus *gadgets.OneLiner
path *gadgets.OneLiner path *gadgets.OneLiner
goSrcPath *gadgets.OneLiner goSrcPath *gadgets.OneLiner

View File

@ -222,13 +222,13 @@ func VerifyLocalGoRepo(gorepo string) bool {
// Form the path to the home Git directory // Form the path to the home Git directory
gitDir := filepath.Join(usr.HomeDir, "go/src/", gorepo, ".git") 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) { if IsDirectory(gitDir) {
return true return true
} }
goDir := filepath.Join(usr.HomeDir, "go/src/", gorepo) goDir := filepath.Join(usr.HomeDir, "go/src/", gorepo)
gomod := goDir + "/go.mod" 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) _, err = os.Stat(gomod)
if os.IsNotExist(err) { if os.IsNotExist(err) {
return false return false