MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / EncodeOutput

Function EncodeOutput

app/cli/cmd/output/output.go:64–73  ·  view source on GitHub ↗

returns either json or table representation of the result

(flagOutputFormat string, v messageType, tableWriter f)

Source from the content-addressed store, hash-verified

62
63// returns either json or table representation of the result
64func EncodeOutput[messageType tabulatedData, f func(messageType) error](flagOutputFormat string, v messageType, tableWriter f) error {
65 switch flagOutputFormat {
66 case FormatJSON:
67 return EncodeJSON(v)
68 case FormatTable:
69 return tableWriter(v)
70 default:
71 return ErrOutputFormatNotImplemented
72 }
73}
74
75func EncodeJSON(v interface{}) error {
76 return EncodeJSONToWriter(v, os.Stdout)

Callers 15

encodeAttestationOutputFunction · 0.92
newWorkflowUpdateCmdFunction · 0.92
newOrganizationSetFunction · 0.92
newOrganizationListFunction · 0.92
newCASBackendAddOCICmdFunction · 0.92
newAttestationStatusCmdFunction · 0.92
newAttestationPushCmdFunction · 0.92

Calls 1

EncodeJSONFunction · 0.85

Tested by

no test coverage detected