formatting for releases

This commit is contained in:
Jeff Carr 2024-12-17 13:13:34 -06:00
parent 7db8376213
commit 23b2b26643
1 changed files with 33 additions and 4 deletions

View File

@ -51,20 +51,20 @@ func (f *Forge) ConfigPrintTable() {
// show information while doing golang releases
func (f *Forge) StandardReleaseHeader(repo *gitpb.Repo, state string) string {
lastTag := repo.GetLastTag()
// tag := repo.NewestTag()
// gitAge, _ := tag.GetDate()
dur := repo.NewestAge()
curname := repo.GetCurrentBranchName()
lastTag := repo.GetLastTag()
target := repo.GetTargetVersion()
master := repo.GetMasterVersion()
user := repo.GetUserVersion()
target := repo.GetTargetVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-20s %-20s %-15s",
repo.GetGoPath(), shell.FormatDuration(dur), curname,
lastTag, target,
master, user,
lastTag, target, master, user,
state)
return header
}
@ -76,3 +76,32 @@ func ReleaseReportHeader() string {
"MASTER", "USER",
"STATE")
}
func (f *Forge) PrintReleaseReport() int {
var count int
log.Info(ReleaseReportHeader())
loop := f.Repos.SortByFullPath()
for loop.Scan() {
check := loop.Next()
if f.Config.IsReadOnly(check.GetGoPath()) {
continue
}
if check.GetLastTag() == check.GetTargetVersion() {
continue
}
count += 1
if check == nil {
log.Info("boo, you didn't git clone", check.GetGoPath())
continue
}
var state string
if check.CheckDirty() {
state = "(dirty)"
}
log.Info(f.StandardReleaseHeader(check, state))
}
log.Info(fmt.Sprintf("total repo count = %d", count))
return count
}