MCPcopy Create free account
hub / github.com/AndroidPoet/playconsole-cli / getStructHeaders

Function getStructHeaders

internal/output/output.go:408–422  ·  view source on GitHub ↗
(v reflect.Value)

Source from the content-addressed store, hash-verified

406}
407
408func getStructHeaders(v reflect.Value) []string {
409 t := v.Type()
410 headers := make([]string, 0, t.NumField())
411 for i := 0; i < t.NumField(); i++ {
412 field := t.Field(i)
413 // Use json tag if available
414 if tag := field.Tag.Get("json"); tag != "" && tag != "-" {
415 parts := strings.Split(tag, ",")
416 headers = append(headers, strings.ToUpper(parts[0]))
417 } else {
418 headers = append(headers, strings.ToUpper(field.Name))
419 }
420 }
421 return headers
422}
423
424func getStructValues(v reflect.Value) []string {
425 values := make([]string, 0, v.NumField())

Callers 4

printTableFunction · 0.85
printTSVFunction · 0.85
printCSVFunction · 0.85
markdownRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected