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

@@ -58,8 +58,8 @@ func ClusterList(conf *cfg.Config) error {
wg.Wait()
table := printer.NewTable(conf, 5, len(conf.Clusters))
table.Addheaders("cluster", "uri", "reachable", "current", "error")
table := printer.NewTable(conf).WithSize(5, len(conf.Clusters)).
WithHeaders("cluster", "uri", "reachable", "current", "error")
idx := 0
@@ -212,8 +212,8 @@ func ClusterStatus(conf *cfg.Config) error {
}
}
table := printer.NewTable(conf, 2, 7)
table.Addheaders(conf.DefaultCluster.Name, "status")
table := printer.NewTable(conf).WithSize(2, 7).
WithHeaders(conf.DefaultCluster.Name, "status")
table.Entries = [][]any{
{"Cluster Name", res.health.ClusterName},
@@ -291,7 +291,7 @@ func gatherClusterStats(clusterstats *clusterstats.Response, table *printer.Tabl
{"indices", clusterstats.Indices.Count},
{"Docs", clusterstats.Indices.Docs.Count},
{"Total Size", printer.Bytes(clusterstats.Indices.Docs.TotalSizeInBytes)},
{"Total Queries", "%d", querycount},
{"Total Queries", querycount},
{"Shards Primaries", clusterstats.Indices.Shards.Primaries},
{"Shards Total", clusterstats.Indices.Shards.Total},
{"Storage", fmt.Sprintf(