diff options
| author | Jeff Carr <[email protected]> | 2025-10-14 07:52:52 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-14 07:52:52 -0500 | 
| commit | 332dbb9287327a1477ed07ebcc4cfca3f418a376 (patch) | |
| tree | 91fda0ff6d745f2d2e882a6a4460f6b0c21615ac | |
| parent | d7be78aeaa1bcb8186233f5f8807d5d0c2a5dfb0 (diff) | |
cleaned upv0.0.89
| -rw-r--r-- | tableSmart.go | 45 | 
1 files changed, 31 insertions, 14 deletions
diff --git a/tableSmart.go b/tableSmart.go index 64a9877..69bb366 100644 --- a/tableSmart.go +++ b/tableSmart.go @@ -3,6 +3,8 @@  package zoopb  import ( +	"strings" +  	"go.wit.com/lib/cobol"  	"go.wit.com/log"  ) @@ -37,6 +39,28 @@ func (m *Machine) PrintInstalledTable() {  	log.Printf("pb.SmartTable: %d installed packages\n", installed.Len())  } +func (t *PackagesTable) AddSmartVersion() *PackageFunc { +	sf := t.AddStringFunc("Version", func(m *Package) string { +		parts := strings.Split(m.Version, "-") +		if len(parts) == 2 { +			log.Info("2", parts) +			if strings.HasPrefix(parts[1], "2025") { +				return parts[0] +			} +		} +		if len(parts) == 4 { +			log.Info("3", parts) +			if strings.HasPrefix(parts[3], "2025") { +				return parts[0] + "-" + parts[1] + "-" + parts[2] +			} +		} +		log.Info(len(parts), parts) +		return m.Version +	}) +	sf.Width = 10 +	return sf +} +  func (m *Machine) makeSmartTable(pb *Packages) *PackagesTable {  	t := pb.NewTable("apt packages")  	t.NewUuid() @@ -59,22 +83,21 @@ func (m *Machine) makeSmartTable(pb *Packages) *PackagesTable {  	})  	col.Width = 1 +	col = t.AddPackage() +	col.Width = 16 + +	col = t.AddSmartVersion() +  	col = t.AddStringFunc("DebCtime", func(p *Package) string {  		if p.DebInfo == nil {  			return "debinfo == nil"  		}  		if p.DebInfo.DebCtime != "" { -			return p.DebInfo.DebCtime -		} -		if p.BuildDate != nil { -			return "not " + cobol.Time(p.BuildDate) -		} -		if p.Ctime != nil { -			return "lies " + cobol.Time(p.Ctime) +			return cobol.Time(p.DebInfo.DebCtime)  		}  		return ""  	}) -	col.Width = 22 +	col.Width = 28  	col = t.AddStringFunc("anytime", func(p *Package) string {  		if p.DebInfo == nil { @@ -90,12 +113,6 @@ func (m *Machine) makeSmartTable(pb *Packages) *PackagesTable {  	})  	col.Width = 22 -	col = t.AddPackage() -	col.Width = 16 - -	col = t.AddVersion() -	col.Width = 20 -  	col = t.AddStringFunc("md5sum", func(p *Package) string {  		if p.DebInfo == nil {  			return ""  | 
