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/urfave/cli/v3"
)
@@ -65,7 +66,7 @@ func ClusterSettingsList(conf *cfg.Config) error {
return fmt.Errorf("failed to get cluster settings: %s", err)
}
table := NewTable(2, 0)
table := printer.NewTable(conf, 2, 0)
table.Addheaders("setting", "value")
entries := [][]string{}
@@ -94,10 +95,10 @@ func ClusterSettingsList(conf *cfg.Config) error {
}
}
table.entries = entries
table.Entries = entries
table.Sort()
if err := table.PrintMarkdown(); err != nil {
if err := table.Print(); err != nil {
return err
}