MCPcopy
hub / github.com/cli/cli / ExportData

Method ExportData

pkg/search/result.go:282–299  ·  view source on GitHub ↗
(fields []string)

Source from the content-addressed store, hash-verified

280}
281
282func (code Code) ExportData(fields []string) map[string]interface{} {
283 v := reflect.ValueOf(code)
284 data := map[string]interface{}{}
285 for _, f := range fields {
286 switch f {
287 case "textMatches":
288 matches := make([]interface{}, 0, len(code.TextMatches))
289 for _, match := range code.TextMatches {
290 matches = append(matches, match.ExportData(textMatchFields))
291 }
292 data[f] = matches
293 default:
294 sf := fieldByName(v, f)
295 data[f] = sf.Interface()
296 }
297 }
298 return data
299}
300
301func (textMatch TextMatch) ExportData(fields []string) map[string]interface{} {
302 return cmdutil.StructExportData(textMatch, fields)

Callers

nothing calls this directly

Calls 2

fieldByNameFunction · 0.70
ExportDataMethod · 0.65

Tested by

no test coverage detected