Skip to content

Commit

Permalink
CLI: show configured backend providers
Browse files Browse the repository at this point in the history
* config.backend section is hidden - still,
  show respective _completion_ and minimal content

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Aug 2, 2024
1 parent be7ca27 commit ba492a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/cli/cli/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ func setNodeConfigCompletions(c *cli.Context) {
v = &config.LocalConfig
} else if argLast(c) == cfgScopeInherited {
fmt.Println(cmdReset)
fmt.Println("backend") // NOTE special case: custom marshaling (ref 080235)
}
err := cmn.IterFields(v, func(tag string, _ cmn.IterField) (err error, b bool) {
props.Set(tag)
Expand Down Expand Up @@ -336,6 +337,12 @@ func setCluConfigCompletions(c *cli.Context) {
if propValueCompletion(c, false /*bucket scope*/) {
return
}

// NOTE special case: custom marshaling (ref 080235)
if c.NArg() == 0 {
propList = append(propList, "backend")
}

for _, prop := range propList {
if !cos.AnyHasPrefixInSlice(prop, c.Args()) {
fmt.Println(prop)
Expand Down
8 changes: 8 additions & 0 deletions cmd/cli/cli/show_hdlr.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,10 @@ func showClusterConfig(c *cli.Context, section string) error {
return err
}

if section == "backend" {
// NOTE special case: custom marshaling (ref 080235)
usejs = true
}
if usejs && section != "" {
if printSectionJSON(c, cluConfig, section) {
return nil
Expand Down Expand Up @@ -778,6 +782,10 @@ func showNodeConfig(c *cli.Context) error {
}
}

if section == "backend" {
// NOTE special case: custom marshaling (ref 080235)
usejs = true
}
if usejs {
opts := teb.Jopts(true)
warn := "option " + qflprn(jsonFlag) + " won't show node <=> cluster configuration differences, if any."
Expand Down

0 comments on commit ba492a1

Please sign in to comment.