mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 05:04:18 +02:00
streamline table api (#101)
This commit is contained in:
@@ -59,8 +59,8 @@ func IndexTemplateList(conf *cfg.Config, filter string) error {
|
||||
|
||||
slog.Debug("res", "index templates", res)
|
||||
|
||||
table := printer.NewTable(conf, 5, 0)
|
||||
table.Addheaders("name", "description", "index patterns", "priority")
|
||||
table := printer.NewTable(conf).WithSize(5, 0).
|
||||
WithHeaders("name", "description", "index patterns", "priority")
|
||||
|
||||
tplList := filterIndexTemplates(conf, filter, res.IndexTemplates)
|
||||
|
||||
@@ -120,8 +120,8 @@ func IndexTemplateShow(conf *cfg.Config, tplname string) error {
|
||||
|
||||
tpl := res.IndexTemplates[0]
|
||||
|
||||
table := printer.NewTable(conf, 2, 6)
|
||||
table.Addheaders("index template property", "value")
|
||||
table := printer.NewTable(conf).WithSize(2, 6).
|
||||
WithHeaders("index template property", "value")
|
||||
|
||||
desc, err := json.Marshal(tpl.IndexTemplate.Meta_["description"])
|
||||
if err != nil {
|
||||
@@ -148,8 +148,8 @@ func IndexTemplateShow(conf *cfg.Config, tplname string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
table = printer.NewTable(conf, 2, 0)
|
||||
table.Addheaders("index setting property", "value")
|
||||
table = printer.NewTable(conf).WithSize(2, 0).
|
||||
WithHeaders("index setting property", "value")
|
||||
|
||||
err = getIndexTemplateSettings(conf, tplname, table)
|
||||
if err != nil {
|
||||
@@ -162,8 +162,8 @@ func IndexTemplateShow(conf *cfg.Config, tplname string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
table = printer.NewTable(conf, 2, 0)
|
||||
table.Addheaders("index field mapping", "type")
|
||||
table = printer.NewTable(conf).WithSize(2, 0).
|
||||
WithHeaders("index field mapping", "type")
|
||||
|
||||
if tpl.IndexTemplate.Template.Mappings != nil {
|
||||
for name, field := range tpl.IndexTemplate.Template.Mappings.Properties {
|
||||
@@ -441,8 +441,8 @@ func rolloverAliasIndexTemplate(conf *cfg.Config, name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
table := printer.NewTable(conf, 4, 0)
|
||||
table.Addheaders("rollover alias", "status", "ack", "new index")
|
||||
table := printer.NewTable(conf).WithSize(4, 0).
|
||||
WithHeaders("rollover alias", "status", "ack", "new index")
|
||||
|
||||
// apply rollover to all matching aliases, if any
|
||||
for alias := range aliases {
|
||||
|
||||
Reference in New Issue
Block a user