MCPcopy Create free account
hub / github.com/GetStream/stream-cli / PrintObject

Function PrintObject

pkg/utils/printer.go:13–27  ·  view source on GitHub ↗
(cmd *cobra.Command, object interface{})

Source from the content-addressed store, hash-verified

11)
12
13func PrintObject(cmd *cobra.Command, object interface{}) error {
14 format, err := cmd.Flags().GetString("output-format")
15 if err != nil {
16 return err
17 }
18
19 switch format {
20 case "json":
21 return printJSONObject(cmd, object)
22 case "tree":
23 return printUIObject(cmd, object)
24 default:
25 return fmt.Errorf("unknown output format: %s", format)
26 }
27}
28
29func printJSONObject(cmd *cobra.Command, object interface{}) error {
30 b, err := json.MarshalIndent(object, "", " ")

Callers 15

queryCmdFunction · 0.92
listCmdFunction · 0.92
testCmdFunction · 0.92
uploadCmdFunction · 0.92
getCmdFunction · 0.92
listCmdFunction · 0.92
getCmdFunction · 0.92
getCmdFunction · 0.92
listCmdFunction · 0.92
getCmdFunction · 0.92
listenCmdFunction · 0.92
listCmdFunction · 0.92

Calls 2

printJSONObjectFunction · 0.85
printUIObjectFunction · 0.85

Tested by

no test coverage detected