From c5ba7ffcb12931b0507365142e73dd79cedaf901 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 16 Oct 2025 04:15:37 -0500 Subject: make autogenerated config tables. bye old cruft! --- Makefile | 7 ++++++- forgeConfig.proto | 2 +- human.go | 10 ++-------- humanShowRepo.go | 12 ++---------- tableConfigs.go | 26 ++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 tableConfigs.go diff --git a/Makefile b/Makefile index 6c40268..890ded4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ -all: set.pb.go goimports vet +all: autogenpb goimports vet @echo This GO code passes the compile checks +autogenpb: + autogenpb --proto set.proto + autogenpb --proto patch.proto + autogenpb --proto forgeConfig.proto + proto-renumber: clean autogenpb --renumber --proto set.proto autogenpb --renumber --proto patch.proto diff --git a/forgeConfig.proto b/forgeConfig.proto index 8bd7325..a64060b 100644 --- a/forgeConfig.proto +++ b/forgeConfig.proto @@ -47,7 +47,7 @@ enum ForgeMode { CLEAN = 6; // indicates "clean" was run } -message ForgeConfigs { // `autogenpb:marshal` `autogenpb:nomutex` +message ForgeConfigs { // `autogenpb:marshal` `autogenpb:nomutex` `autogenpb:gui` string uuid = 1; // `autogenpb:uuid:1941cd4f-1cfd-4bf6-aa75-c2c391907e81` string version = 2; // `autogenpb:version:v0.0.47` repeated ForgeConfig ForgeConfigs = 3; diff --git a/human.go b/human.go index e5ce98d..fab41d1 100644 --- a/human.go +++ b/human.go @@ -2,14 +2,6 @@ package forgepb -import ( - "fmt" - - "go.wit.com/lib/gui/shell" - "go.wit.com/lib/protobuf/gitpb" - "go.wit.com/log" -) - // OLD STUFF. REMOVE. USE PROTOBUF TABLES // mostly just functions related to making STDOUT @@ -19,6 +11,7 @@ import ( // so reporting tables of the status of what droplets and hypervisors // are in text columns and rows that can be easily read in a terminal +/* func standardHeader() string { return fmt.Sprintf("%-4s %-40s %s", "", "Path", "flags") } @@ -115,3 +108,4 @@ func (f *Forge) PrintReleaseReport(repos *gitpb.Repos) int { log.Info(fmt.Sprintf("total repo count = %d", count)) return count } +*/ diff --git a/humanShowRepo.go b/humanShowRepo.go index dd2582a..cbc433d 100644 --- a/humanShowRepo.go +++ b/humanShowRepo.go @@ -2,16 +2,7 @@ package forgepb -import ( - "os" - "path/filepath" - "time" - - "go.wit.com/lib/gui/shell" - "go.wit.com/lib/protobuf/gitpb" - "go.wit.com/log" -) - +/* func (f *Forge) HumanPrintRepo(check *gitpb.Repo) { if check == nil { log.Info("forge: you sent me nil") @@ -96,3 +87,4 @@ func printTime(s string, t time.Time) { log.Printf("%s mtime last changed %s\n", s, shell.FormatDuration(dur)) } } +*/ diff --git a/tableConfigs.go b/tableConfigs.go new file mode 100644 index 0000000..914c4af --- /dev/null +++ b/tableConfigs.go @@ -0,0 +1,26 @@ +// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 + +package forgepb + +import ( + "go.wit.com/log" +) + +// returns footer +func (pb *ForgeConfigs) PrintTable() string { + if pb == nil { + return "pb was nil" + } + tablePB := pb.MakeTable() + tablePB.PrintTable() + return log.Sprintf("forge Configs DefaultTable: %d entries", pb.Len()) +} + +func (pb *ForgeConfigs) MakeTable() *ForgeConfigsTable { + t := pb.NewTable("tagList") + t.NewUuid() + + col := t.AddNamespace() + col.Width = 28 + return t +} -- cgit v1.2.3