add -p -t -D flags to cluster settings ls (#10)

This commit is contained in:
T. von Dein
2026-05-06 07:25:27 +02:00
parent a71be5001a
commit af75bfa192
3 changed files with 45 additions and 15 deletions

View File

@@ -39,20 +39,20 @@ type Cluster struct {
}
type Config struct {
ConfigFile string // -c
CurrentCluster string // -C
Debug bool // -d
Clusters map[string]*Cluster
DefaultCluster *Cluster
Index string // index: -i
Failed, Partials bool // index: flags
Shards, Replicas int // index create: -s -r
Wait bool // index create: -w
From, To, MaxItems int // search: flags
Filter []string // search: -F
Exclude string // cluster compare: -e (regexp)
All bool // cluster status: -a
Persistent, Transient bool // -p -t cluster settings set
ConfigFile string // -c
CurrentCluster string // -C
Debug bool // -d
Clusters map[string]*Cluster
DefaultCluster *Cluster
Index string // index: -i
Failed, Partials bool // index: flags
Shards, Replicas int // index create: -s -r
Wait bool // index create: -w
From, To, MaxItems int // search: flags
Filter []string // search: -F
Exclude string // cluster compare: -e (regexp)
All bool // cluster status: -a
Persistent, Transient, Default bool // -p -t -D cluster settings set
}
func NewConfig() *Config {

View File

@@ -147,7 +147,16 @@ func ClusterSettingsList(conf *cfg.Config) error {
table.Addheaders("setting", "value")
entries := [][]string{}
for topic, val := range res.Persistent {
settingshash := res.Persistent // == map[string]json.RawMessage
switch {
case conf.Transient:
settingshash = res.Transient
case conf.Default:
settingshash = res.Defaults
}
for topic, val := range settingshash {
data := map[string]map[string]any{}
err := json.Unmarshal(val, &data)