mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 10:04:18 +02:00
add index ls command, add table and color support
This commit is contained in:
@@ -18,6 +18,7 @@ package es
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"log/slog"
|
||||
|
||||
@@ -30,7 +31,20 @@ func Health(conf *cfg.Config) error {
|
||||
log.Fatalf("Error getting health: %s", err)
|
||||
}
|
||||
|
||||
slog.Info("ES result", "cluster health", res)
|
||||
slog.Debug("ES result", "cluster health", res)
|
||||
|
||||
table := NewTable(5)
|
||||
|
||||
table.headers = []string{bold("SETTING"), bold("STATUS")}
|
||||
|
||||
table.entries = [][]string{
|
||||
{"Cluster Name", Colorize(*&res.Status.Name, res.ClusterName)},
|
||||
{"Active Shards", fmt.Sprintf("%d", res.ActiveShards)},
|
||||
{"Active Primary Shards", fmt.Sprintf("%d", res.ActivePrimaryShards)},
|
||||
{"Indicies", fmt.Sprintf("%d", len(res.Indices))},
|
||||
{"Nodes", fmt.Sprintf("%d", res.NumberOfNodes)},
|
||||
}
|
||||
|
||||
table.PrintMarkdown()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user