MCPcopy
hub / github.com/canopy-network/canopy / writeToConsole

Function writeToConsole

cmd/cli/cli.go:298–317  ·  view source on GitHub ↗
(a any, err error)

Source from the content-addressed store, hash-verified

296}
297
298func writeToConsole(a any, err error) {
299 if err != nil {
300 l.Fatal(err.Error())
301 }
302 switch a.(type) {
303 case int, uint32, uint64:
304 p := message.NewPrinter(language.English)
305 if _, err := p.Printf("%d\n", a); err != nil {
306 l.Fatal(err.Error())
307 }
308 case string, *string:
309 fmt.Println(a)
310 default:
311 s, err := lib.MarshalJSONIndentString(a)
312 if err != nil {
313 l.Fatal(err.Error())
314 }
315 fmt.Println(s)
316 }
317}
318
319// AUTO COMPLETE CODE BELOW
320

Callers 4

query.goFile · 0.85
cli.goFile · 0.85
admin.goFile · 0.85
writeTxResultToConsoleFunction · 0.85

Calls 4

MarshalJSONIndentStringFunction · 0.92
FatalMethod · 0.65
ErrorMethod · 0.65
PrintfMethod · 0.65

Tested by

no test coverage detected