(args []string)
| 76 | } |
| 77 | |
| 78 | func (c *SecretsListCommand) Run(args []string) int { |
| 79 | f := c.Flags() |
| 80 | |
| 81 | if err := f.Parse(args); err != nil { |
| 82 | c.UI.Error(err.Error()) |
| 83 | return 1 |
| 84 | } |
| 85 | |
| 86 | args = f.Args() |
| 87 | if len(args) > 0 { |
| 88 | c.UI.Error(fmt.Sprintf("Too many arguments (expected 0, got %d)", len(args))) |
| 89 | return 1 |
| 90 | } |
| 91 | |
| 92 | client, err := c.Client() |
| 93 | if err != nil { |
| 94 | c.UI.Error(err.Error()) |
| 95 | return 2 |
| 96 | } |
| 97 | |
| 98 | mounts, err := client.Sys().ListMounts() |
| 99 | if err != nil { |
| 100 | c.UI.Error(fmt.Sprintf("Error listing secrets engines: %s", err)) |
| 101 | return 2 |
| 102 | } |
| 103 | |
| 104 | switch Format(c.UI) { |
| 105 | case "table": |
| 106 | if c.flagDetailed { |
| 107 | c.UI.Output(tableOutput(c.detailedMounts(mounts), nil)) |
| 108 | return 0 |
| 109 | } |
| 110 | c.UI.Output(tableOutput(c.simpleMounts(mounts), nil)) |
| 111 | return 0 |
| 112 | default: |
| 113 | return OutputData(c.UI, mounts) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | func (c *SecretsListCommand) simpleMounts(mounts map[string]*api.MountOutput) []string { |
| 118 | paths := make([]string, 0, len(mounts)) |
nothing calls this directly
no test coverage detected