From 98926bf2f80a25e51429d74182254da1103bdbc7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 4 Nov 2024 02:14:54 -0600 Subject: ignore new repos until init() Signed-off-by: Jeff Carr --- common.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'common.go') diff --git a/common.go b/common.go index d913598..2dc38ef 100644 --- a/common.go +++ b/common.go @@ -5,8 +5,10 @@ import ( "os" "path/filepath" "sort" + "time" "go.wit.com/gui" + "go.wit.com/lib/gui/shell" "go.wit.com/lib/gui/repostatus" "go.wit.com/log" ) @@ -23,6 +25,11 @@ func (r *RepoList) Hide() { r.reposbox.Hide() } +// better name: use this +func (r *RepoList) FindRepoByName(path string) *RepoRow { + return r.FindRepo(path) +} + func (r *RepoList) FindRepo(path string) *RepoRow { repo, _ := me.allrepos[path] return repo @@ -219,3 +226,18 @@ func (rl *RepoList) MakeGoWork() error { fmt.Fprintln(f, ")") return nil } + +// makes a human readable thing for standard out. +func (r *RepoRow) StandardHeader() string { + lastTag := r.LastTag() + tag := r.Status.NewestTag() + gitAge, _ := tag.GetDate() + dur := time.Since(gitAge) + + master := r.Status.GetMasterVersion() + 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 +} -- cgit v1.2.3