MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / printJSON

Function printJSON

internal/cli/cli_helpers.go:256–265  ·  view source on GitHub ↗

printJSON marshals v as indented JSON and writes it to stdout.

(v any)

Source from the content-addressed store, hash-verified

254
255// printJSON marshals v as indented JSON and writes it to stdout.
256func printJSON(v any) error {
257 data, err := json.MarshalIndent(v, "", " ")
258 if err != nil {
259 return fmt.Errorf("json marshal: %w", err)
260 }
261
262 fmt.Println(string(data))
263
264 return nil
265}
266
267// printError writes a JSON error object to stderr and returns err unchanged so
268// callers can `return printError(err)`.

Callers 15

runStorageListFunction · 0.85
runStorageShowFunction · 0.85
runStorageContentListFunction · 0.85
runStorageContentDeleteFunction · 0.85
runStorageDownloadURLFunction · 0.85
runStorageDownloadOCIFunction · 0.85
runStorageRestoreFunction · 0.85
TestPrintJSONFunction · 0.85
runNodesListFunction · 0.85
runNodesShowFunction · 0.85
runTasksListFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPrintJSONFunction · 0.68