Add support for recursive listing (#885)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-01-25 19:37:40 -05:00
1 parent 1f9fcad1cd
commit 6cd97a4a6e
77 files changed
+2244 -1448

No files matched your search

@@ -32,7 +32,7 @@ func (c *Command) Synopsis() string {
var flagsMap = map[string][]string{
"read": {"id"},
"delete": {"id"},
"list": {"scope-id"},
"list": {"scope-id", "recursive"},
}
func (c *Command) Help() string {
@@ -138,7 +138,6 @@ func (c *Command) Run(args []string) int {
default:
opts = append(opts, authmethods.WithName(c.FlagName))
}
switch c.FlagDescription {
case "":
case "null":
@@ -146,6 +145,10 @@ func (c *Command) Run(args []string) int {
default:
opts = append(opts, authmethods.WithDescription(c.FlagDescription))
}
switch c.FlagRecursive {
case true:
opts = append(opts, authmethods.WithRecursive(true))
}
authmethodClient := authmethods.NewClient(client)
@@ -230,9 +233,14 @@ func (c *Command) Run(args []string) int {
fmt.Sprintf(" ID: %s", m.Id),
)
}
if m.Description != "" {
if c.FlagRecursive {
output = append(output,
fmt.Sprintf(" Description: %s", m.Description),
fmt.Sprintf(" Scope ID: %s", m.Scope.Id),
)
}
if true {
output = append(output,
fmt.Sprintf(" Version: %d", m.Version),
)
}
if m.Name != "" {
@@ -240,6 +248,11 @@ func (c *Command) Run(args []string) int {
fmt.Sprintf(" Name: %s", m.Name),
)
}
if m.Description != "" {
output = append(output,
fmt.Sprintf(" Description: %s", m.Description),
)
}
if true {
output = append(output,
fmt.Sprintf(" Type: %s", m.Type),