Refactor output code, add JSON, TSV and YAML output modes, add -o (#19), add version subcommand

This commit is contained in:
T. von Dein
2026-05-20 13:06:39 +02:00
parent 32de4863af
commit 0870ceb3df
16 changed files with 439 additions and 190 deletions

View File

@@ -23,6 +23,7 @@ import (
"log/slog"
"codeberg.org/scip/esctl/pkg/cfg"
"codeberg.org/scip/esctl/pkg/printer"
"github.com/elastic/go-elasticsearch/v9/typedapi/types"
)
@@ -115,10 +116,10 @@ func CcrRemoteInfo(conf *cfg.Config, index string) error {
mode = "leader"
}
table := NewTable(2, 5)
table := printer.NewTable(conf, 2, 5)
table.Addheaders("ccr remote property", "value")
table.entries = [][]string{
table.Entries = [][]string{
{"Remote Cluster", remote},
{"CCR Mode", mode},
{"Connected", fmt.Sprintf("%t", info.Connected)},
@@ -126,7 +127,7 @@ func CcrRemoteInfo(conf *cfg.Config, index string) error {
{"Proxy Address", info.ProxyAddress},
}
if err := table.PrintMarkdown(); err != nil {
if err := table.Print(); err != nil {
return err
}