// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 package forgepb import ( "time" "go.wit.com/log" ) // returns footer func (pset *Set) PrintTable() string { if pset == nil || pset.Patches == nil { return "pb was nil" } log.DaemonMode(true) // don't timestamp lines tablePB := pset.Patches.MakeTable() tablePB.PrintTable() return log.Sprintf("pset.DefaultTable: %d patches", pset.Patches.Len()) } func (pb *Sets) PrintTable() { for pset := range pb.IterAll() { if pset.Patches == nil { continue } tablePB := pset.Patches.MakeTable() tablePB.PrintTable() log.Printf("psets.DefaultTable loop: %d patches\n", pset.Patches.Len()) } } // returns footer func (pb *Patches) PrintTable() string { log.DaemonMode(true) // don't timestamp lines tablePB := pb.MakeTable() tablePB.PrintTable() return log.Sprintf("default patches table %d patches", pb.Len()) } func (pb *Patches) MakeTable() *PatchesTable { t := pb.NewTable("tagList") t.NewUuid() col := t.AddNamespace() col.Width = 28 col = t.AddCommitHash() col.Width = 8 col = t.AddPatchId() col.Width = 8 col = t.AddNewHash() col.Width = 8 col = t.AddTimeFunc("ctime", func(p *Patch) time.Time { // todo return p.Ctime.AsTime() }) col.Width = 12 col = t.AddState() col.Width = 20 col = t.AddStateChange() col.Width = 20 col = t.AddComment() col.Width = -1 return t }