diff options
| -rw-r--r-- | key.proto | 2 | ||||
| -rw-r--r-- | table.go | 49 |
2 files changed, 12 insertions, 39 deletions
@@ -11,7 +11,7 @@ message Key { // string help = 4; // text for explaining the ENV key/value } -message Keys { // `autogenpb:marshal` `autogenpb:nomutex` `autogenpb:gui` +message Keys { // `autogenpb:marshal` `autogenpb:nomutex` string uuid = 1; // `autogenpb:uuid:7a8aaf7f-9851-42f0-89eb-434d2e51f5bb` string version = 2; // `autogenpb:version:v0.0.1 go.wit.com/lib/ENV` repeated Key keys = 3; @@ -2,45 +2,18 @@ package ENV -import "fmt" +import ( + "fmt" -func PrintTable() string { - t := envPB.MakeTable("ENV table") + "go.wit.com/lib/cobol" +) - // limit the number of lines - t.PrintTable() +func PrintTable() string { + var data [][]string + data = append(data, []string{"New Source", "ENV[name]", "Value"}) + for k := range envPB.IterAll() { + data = append(data, []string{k.Global, k.Var, k.Value}) + } + cobol.SimpleTableSizes(data, []int{20, 20, -1}) return fmt.Sprintf("ENV: total=(%d)", envPB.Len()) } - -func (pb *Keys) MakeTable(name string) *KeysTable { - t := pb.NewTable(name) - t.NewUuid() - - var col *KeyFunc - - col = t.AddStringFunc("Source", func(k *Key) string { - return k.Global - }) - col.Width = 20 - - col = t.AddVar() - col.Width = 20 - col.Header.Name = "ENV[name] =" - - col = t.AddValue() - col.Width = -1 - col.Header.Name = "Value" - // col.Header.Name = "Git Hash" - - /* - col = t.AddStringFunc("age", func(r *Key) string { - return cobol.Time(r.Ctime) - }) - col.Width = 28 - - col = t.AddSubject() - col.Width = -1 - */ - - return t -} |
