MCPcopy Create free account
hub / github.com/github/gh-aw / applyTagFormat

Function applyTagFormat

pkg/console/render.go:575–585  ·  view source on GitHub ↗

applyTagFormat applies a named format (number, cost, filesize) to baseValue.

(val reflect.Value, format, baseValue string)

Source from the content-addressed store, hash-verified

573
574// applyTagFormat applies a named format (number, cost, filesize) to baseValue.
575func applyTagFormat(val reflect.Value, format, baseValue string) string {
576 switch format {
577 case "number":
578 return applyNumberFormat(val, baseValue)
579 case "cost":
580 return applyCostFormat(val, baseValue)
581 case "filesize":
582 return applyFilesizeFormat(val, baseValue)
583 }
584 return baseValue
585}
586
587// applyNumberFormat formats a value as a human-readable number (e.g., "1k", "1.2M").
588func applyNumberFormat(val reflect.Value, baseValue string) string {

Callers 1

formatFieldValueWithTagFunction · 0.85

Calls 3

applyNumberFormatFunction · 0.85
applyCostFormatFunction · 0.85
applyFilesizeFormatFunction · 0.85

Tested by

no test coverage detected