summaryrefslogtreecommitdiff
path: root/human.go
diff options
context:
space:
mode:
Diffstat (limited to 'human.go')
-rw-r--r--human.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/human.go b/human.go
index dcf2289..7033985 100644
--- a/human.go
+++ b/human.go
@@ -2,7 +2,10 @@ package forgepb
import (
"fmt"
+ "time"
+ "go.wit.com/lib/gui/shell"
+ "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -46,3 +49,40 @@ func (f *Forge) ConfigPrintTable() {
log.Info(f.standardHeader(r))
}
}
+
+func (f *Forge) newestAge(repo *gitpb.Repo) time.Duration {
+ loop := repo.Tags.SortByAge()
+ for loop.Scan() {
+ r := loop.Next()
+ return time.Since(r.GetAuthordate().AsTime())
+ }
+ return time.Since(time.Now())
+}
+
+// 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 := f.newestAge(repo)
+
+ curname := repo.GetCurrentBranchName()
+ 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,
+ state)
+ return header
+}
+
+func ReleaseReportHeader() string {
+ return fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-20s %-20s %-15s",
+ "REPO", "AGE", "CUR BR",
+ "LAST", "TARGET",
+ "MASTER", "USER",
+ "STATE")
+}