streamline table api (#101)

This commit is contained in:
T. von Dein
2026-08-09 21:53:47 +02:00
parent 59331fc721
commit 325433ed81
30 changed files with 349 additions and 316 deletions

View File

@@ -85,8 +85,8 @@ func IlmList(conf *cfg.Config, pattern string) error {
repr.Println(res)
}
table := printer.NewTable(conf, 5, 0)
table.Addheaders("ilm policy", "hot", "warm", "frozen", "delete")
table := printer.NewTable(conf).WithSize(5, 0).
WithHeaders("ilm policy", "hot", "warm", "frozen", "delete")
for name, ilm := range res {
table.AddRow(name,
@@ -123,8 +123,8 @@ func IlmShow(conf *cfg.Config, policy string) error {
return IlmShowTree(conf, ilm.Policy)
}
table := printer.NewTable(conf, 2, 5)
table.Addheaders("ilm policy setting", "value")
table := printer.NewTable(conf).WithSize(2, 5).
WithHeaders("ilm policy setting", "value")
table.Entries = [][]any{
{"policy", policy},
@@ -142,9 +142,6 @@ func IlmShow(conf *cfg.Config, policy string) error {
func IlmShowTree(conf *cfg.Config, ilm types.IlmPolicy) error {
indent := ""
table := printer.NewTable(conf, 4, 0)
table.Addheaders("phase", "min age", "min size", "snapshot repo")
for _, phase := range IlmPhaseOrder {
if phase == "hot" {
fmt.Printf("%s%s phase:\n%s rollover after %s\n",
@@ -280,8 +277,8 @@ func IlmExplain(conf *cfg.Config, index string) error {
ilm := explain.(*types.LifecycleExplainManaged)
table := printer.NewTable(conf, 2, 0)
table.Addheaders("ilm status field", "value")
table := printer.NewTable(conf).WithSize(2, 0).
WithHeaders("ilm status field", "value")
info := ""