summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tableSmart.go45
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 ""