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

@@ -53,15 +53,24 @@ func IndexNames(conf *cfg.Config) ([]string, error) {
}
func filterIndices(conf *cfg.Config, list indices.Response) indices.Response {
// apply partials filter first
selectedlist := indices.Response{}
for _, index := range list {
if !conf.Partials && strings.HasPrefix(*index.Index, "partial-") {
continue
}
selectedlist = append(selectedlist, index)
}
if len(conf.Filter) == 0 {
return list
return selectedlist
}
// we support just one filter here, for now
filter := *regexp.MustCompile(conf.Filter[0])
newlist := indices.Response{}
for _, index := range list {
for _, index := range selectedlist {
if filter.MatchString(*index.Index) {
newlist = append(newlist, index)
}