MCPcopy Create free account
hub / github.com/hashicorp/vault / outputWithFormat

Function outputWithFormat

command/format.go:50–63  ·  view source on GitHub ↗
(ui cli.Ui, secret *api.Secret, data interface{})

Source from the content-addressed store, hash-verified

48}
49
50func 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
65type Formatter interface {
66 Output(ui cli.Ui, secret *api.Secret, data interface{}) error

Callers 7

TestJsonFormatterFunction · 0.85
TestYamlFormatterFunction · 0.85
TestTableFormatterFunction · 0.85
TestStatusFormatFunction · 0.85
OutputSecretFunction · 0.85
OutputListFunction · 0.85
OutputDataFunction · 0.85

Calls 3

FormatFunction · 0.85
ErrorMethod · 0.65
OutputMethod · 0.65

Tested by 4

TestJsonFormatterFunction · 0.68
TestYamlFormatterFunction · 0.68
TestTableFormatterFunction · 0.68
TestStatusFormatFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…