fix search output order (last on bottom) and index ls output partials (#30)

This commit is contained in:
T. von Dein
2026-06-08 12:09:01 +02:00
parent c4143093fd
commit f30c837d53
7 changed files with 34 additions and 22 deletions

View File

@@ -18,12 +18,24 @@ package printer
import (
"fmt"
"slices"
"codeberg.org/scip/esctl/pkg/cfg"
"github.com/elastic/go-elasticsearch/v9/typedapi/types"
"github.com/tidwall/gjson"
)
func PrintDocs(conf *cfg.Config, hits []types.Hit) {
if !conf.Ascending {
slices.Reverse(hits)
}
for _, hit := range hits {
PrintDoc(conf, hit)
}
}
func PrintDoc(conf *cfg.Config, hit types.Hit) {
var score types.Float64
if hit.Score_ != nil {
@@ -40,6 +52,6 @@ func PrintDoc(conf *cfg.Config, hit types.Hit) {
value := gjson.Get(docjson, conf.Path)
fmt.Println(value.String())
} else {
fmt.Println(docjson)
fmt.Print(docjson)
}
}