MCPcopy Create free account
hub / github.com/cloudwan/gohan / formatOutput

Method formatOutput

cli/client/output.go:30–41  ·  view source on GitHub ↗
(s *schema.Schema, rawResult interface{})

Source from the content-addressed store, hash-verified

28var errorKey = "error"
29
30func (gohanClientCLI *GohanClientCLI) formatOutput(s *schema.Schema, rawResult interface{}) string {
31 if rawResult == nil {
32 return ""
33 }
34 switch gohanClientCLI.opts.outputFormat {
35 case outputFormatTable:
36 return gohanClientCLI.formatOutputTable(s, rawResult)
37 default:
38 result, _ := json.MarshalIndent(rawResult, "", "\t")
39 return fmt.Sprintf("%s", result)
40 }
41}
42
43func (gohanClientCLI *GohanClientCLI) formatOutputTable(s *schema.Schema, rawResult interface{}) string {
44 buffer := bytes.NewBufferString("")

Callers 7

getListCommandMethod · 0.95
getGetCommandMethod · 0.95
getPostCommandMethod · 0.95
getPutCommandMethod · 0.95
getDeleteCommandMethod · 0.95
createActionFuncMethod · 0.95
client_test.goFile · 0.80

Calls 1

formatOutputTableMethod · 0.95

Tested by

no test coverage detected