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

Method createSingleResourceTable

cli/client/output.go:108–120  ·  view source on GitHub ↗
(s *schema.Schema, buffer *bytes.Buffer, resource map[string]interface{})

Source from the content-addressed store, hash-verified

106}
107
108func (gohanClientCLI *GohanClientCLI) createSingleResourceTable(s *schema.Schema, buffer *bytes.Buffer, resource map[string]interface{}) {
109 include := gohanClientCLI.fieldFilter(s)
110 table := tablewriter.NewWriter(buffer)
111 table.SetHeader([]string{"Property", "Value"})
112 for _, property := range s.Properties {
113 if include != nil && !include[normField(property.ID, s.ID)] {
114 continue
115 }
116
117 table.Append([]string{property.Title, fmt.Sprint(resource[property.ID])})
118 }
119 table.Render()
120}
121
122//fieldFilter returns opts filters as string to boolean map with normalised keys.
123func (gohanClientCLI *GohanClientCLI) fieldFilter(s *schema.Schema) map[string]bool {

Callers 1

formatOutputTableMethod · 0.95

Calls 2

fieldFilterMethod · 0.95
normFieldFunction · 0.70

Tested by

no test coverage detected