MCPcopy Create free account
hub / github.com/AndroidPoet/playconsole-cli / printJSON

Function printJSON

internal/output/output.go:97–115  ·  view source on GitHub ↗
(data interface{})

Source from the content-addressed store, hash-verified

95}
96
97func printJSON(data interface{}) error {
98 var output []byte
99 var err error
100
101 if prettyPrint {
102 output, err = json.MarshalIndent(data, "", " ")
103 } else {
104 output, err = json.Marshal(data)
105 }
106
107 if err != nil {
108 return fmt.Errorf("failed to marshal JSON: %w", err)
109 }
110
111 if _, err := fmt.Fprintln(writer, string(output)); err != nil {
112 return fmt.Errorf("failed to write JSON output: %w", err)
113 }
114 return nil
115}
116
117func printTable(data interface{}) error {
118 w := tabwriter.NewWriter(writer, 0, 0, 2, ' ', 0)

Callers 5

PrintFunction · 0.85
printTableFunction · 0.85
printTSVFunction · 0.85
printCSVFunction · 0.85
printMarkdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected