mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 17:24:18 +02:00
streamline table api (#101)
This commit is contained in:
@@ -47,8 +47,8 @@ func RoleList(conf *cfg.Config) error {
|
||||
|
||||
slog.Debug("ES result", "roles", res)
|
||||
|
||||
table := printer.NewTable(conf, 3, len(res))
|
||||
table.Addheaders("role", "index roles", "cluster roles")
|
||||
table := printer.NewTable(conf).WithSize(3, len(res)).
|
||||
WithHeaders("role", "index roles", "cluster roles")
|
||||
|
||||
idx := 0
|
||||
for name, role := range res {
|
||||
@@ -126,8 +126,8 @@ func roleRemoteClusters(conf *cfg.Config, role types.Role) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
table := printer.NewTable(conf, 2, len(role.RemoteCluster))
|
||||
table.Addheaders("remote cluster", "privilege")
|
||||
table := printer.NewTable(conf).WithSize(2, len(role.RemoteCluster)).
|
||||
WithHeaders("remote cluster", "privilege")
|
||||
|
||||
idx := 0
|
||||
|
||||
@@ -152,8 +152,8 @@ func roleClusters(conf *cfg.Config, role types.Role) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
table := printer.NewTable(conf, 1, len(role.Cluster))
|
||||
table.Addheaders("cluster rights")
|
||||
table := printer.NewTable(conf).WithSize(1, len(role.Cluster)).
|
||||
WithHeaders("cluster rights")
|
||||
|
||||
idx := 0
|
||||
for _, cluster := range role.Cluster {
|
||||
@@ -171,8 +171,8 @@ func roleRemoteIndices(conf *cfg.Config, role types.Role) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
table := printer.NewTable(conf, 3, len(role.RemoteIndices))
|
||||
table.Addheaders("remote index names", "index permissions", "allow restricted")
|
||||
table := printer.NewTable(conf).WithSize(3, len(role.RemoteIndices)).
|
||||
WithHeaders("remote index names", "index permissions", "allow restricted")
|
||||
|
||||
idx := 0
|
||||
|
||||
@@ -197,8 +197,8 @@ func roleIndices(conf *cfg.Config, role types.Role) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
table := printer.NewTable(conf, 3, len(role.Indices))
|
||||
table.Addheaders("index names", "index permissions", "allow restricted")
|
||||
table := printer.NewTable(conf).WithSize(3, len(role.Indices)).
|
||||
WithHeaders("index names", "index permissions", "allow restricted")
|
||||
|
||||
idx := 0
|
||||
|
||||
@@ -223,8 +223,8 @@ func roleApplications(conf *cfg.Config, role types.Role) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
table := printer.NewTable(conf, 3, len(role.Applications))
|
||||
table.Addheaders("application", "privileges", "resources")
|
||||
table := printer.NewTable(conf).WithSize(3, len(role.Applications)).
|
||||
WithHeaders("application", "privileges", "resources")
|
||||
|
||||
idx := 0
|
||||
for _, priv := range role.Applications {
|
||||
|
||||
Reference in New Issue
Block a user