report cleanups

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-04 17:13:48 -06:00
parent 4f24f6972a
commit 4fa21db5a9
2 changed files with 42 additions and 55 deletions

View File

@ -100,39 +100,6 @@ func (r *RepoRow) LastTag() string {
return r.lastTag.String()
}
/*
// returns the state of the GO go.mod and go.sum files
// this is used to tell if they are valid and correctly reflect
// the versions of the other GUI packages
// at this point in time, there is _NO_ way to be check our
// be sure that anything will run with older versions
// because this are changing too often at this point
// TODO: revisit this in 2025 or 2026
func (r *RepoRow) GoState() string {
if r == nil {
log.Info("GoState() r == nil")
return "goState == nil"
}
if r.goState == nil {
log.Info("GoState() r.goState == nil")
return "goState == nil"
}
return r.goState.String()
}
func (r *RepoRow) SetGoState(s string) {
if r == nil {
log.Info("SetGoState() r == nil")
return
}
if r.goState == nil {
log.Info("goState == nil")
return
}
r.goState.SetText(s)
}
*/
func (r *RepoRow) IsPerfect() bool {
if r.gitState.String() == "PERFECT" {
return true

View File

@ -22,28 +22,8 @@ func (r *RepoRow) StandardHeader() string {
devel := r.Status.GetDevelVersion()
user := r.Status.GetUserVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-15s", r.Name(), shell.FormatDuration(dur), lastTag, master, devel, user, r.State())
return header
}
// makes a human readable thing for standard out.
func (r *RepoRow) StandardReleaseHeader() string {
lastTag := r.LastTag()
tag := r.Status.NewestTag()
gitAge, _ := tag.GetDate()
dur := time.Since(gitAge)
master := r.Status.GetMasterVersion()
target := r.Status.GetTargetVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-15s %-15s",
r.Name(),
shell.FormatDuration(dur),
lastTag,
master,
target,
r.GoState(),
r.State())
header := fmt.Sprintf("%-35s %5s %-20s %-20s %-20s %-20s %-15s",
r.Name(), shell.FormatDuration(dur), lastTag, master, devel, user, r.State())
return header
}
@ -56,6 +36,12 @@ func msg(w http.ResponseWriter, s string) {
func (v *RepoList) PrintReport(w http.ResponseWriter, readonly string, onlydirty string, perfect string) {
var count int
header := fmt.Sprintf("%-35s %5s %-20s %-20s %-20s %-20s %-15s",
"REPO", "AGE",
"LAST", "MASTER", "DEVEL", "USER",
"STATE")
msg(w, header)
loop := v.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
@ -93,9 +79,40 @@ func (v *RepoList) PrintReport(w http.ResponseWriter, readonly string, onlydirty
msg(w, fmt.Sprintf("EVERYTHING WORKED repo count = %d", count))
}
// makes a human readable thing for standard out.
func (r *RepoRow) StandardReleaseHeader() string {
lastTag := r.LastTag()
tag := r.Status.NewestTag()
gitAge, _ := tag.GetDate()
dur := time.Since(gitAge)
curname := r.Status.GetCurrentBranchName()
master := r.Status.GetMasterVersion()
user := r.Status.GetUserVersion()
target := r.Status.GetTargetVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s",
r.Name(),
shell.FormatDuration(dur),
curname,
lastTag,
master,
target,
user,
r.State())
return header
}
func (v *RepoList) PrintReleaseReport(w http.ResponseWriter, readonly string, perfect string) {
var count int
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s",
"REPO", "AGE", "CUR BR",
"LAST", "MASTER", "TARGET", "USER",
"STATE")
msg(w, header)
loop := v.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
@ -106,6 +123,9 @@ func (v *RepoList) PrintReleaseReport(w http.ResponseWriter, readonly string, pe
if (repo.State() == "PERFECT") && (perfect == "true") {
continue
}
if repo.Status.IsReleased() {
continue
}
count += 1
header := repo.StandardReleaseHeader()
msg(w, header)