From 5341a70557f00b07e95802348c03aa25781ff5b7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 14 Dec 2024 11:28:34 -0600 Subject: [PATCH] shortcut to get the age of a repo --- gitTag.byAge.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gitTag.byAge.go b/gitTag.byAge.go index 9d62acf..3341e08 100644 --- a/gitTag.byAge.go +++ b/gitTag.byAge.go @@ -29,3 +29,12 @@ func (a GitTagAge) Less(i, j int) bool { return false } func (a GitTagAge) Swap(i, j int) { a[i], a[j] = a[j], a[i] } + +func (repo *Repo) NewestAge() time.Duration { + all := repo.Tags.SortByAge() + for all.Scan() { + r := all.Next() + return time.Since(r.GetAuthordate().AsTime()) + } + return time.Since(time.Now()) +}