(ui cli.Ui, secret *api.Secret, data interface{})
| 48 | } |
| 49 | |
| 50 | func outputWithFormat(ui cli.Ui, secret *api.Secret, data interface{}) int { |
| 51 | format := Format(ui) |
| 52 | formatter, ok := Formatters[format] |
| 53 | if !ok { |
| 54 | ui.Error(fmt.Sprintf("Invalid output format: %s", format)) |
| 55 | return 1 |
| 56 | } |
| 57 | |
| 58 | if err := formatter.Output(ui, secret, data); err != nil { |
| 59 | ui.Error(fmt.Sprintf("Could not parse output: %s", err.Error())) |
| 60 | return 1 |
| 61 | } |
| 62 | return 0 |
| 63 | } |
| 64 | |
| 65 | type Formatter interface { |
| 66 | Output(ui cli.Ui, secret *api.Secret, data interface{}) error |
searching dependent graphs…