MCPcopy Create free account
hub / github.com/diillson/chatcli / formatTokenCount

Function formatTokenCount

cli/context_display.go:198–206  ·  view source on GitHub ↗

formatTokenCount formats a token count with K/M suffixes for readability.

(tokens int64)

Source from the content-addressed store, hash-verified

196
197// formatTokenCount formats a token count with K/M suffixes for readability.
198func formatTokenCount(tokens int64) string {
199 if tokens >= 1_000_000 {
200 return fmt.Sprintf("%.1fM", float64(tokens)/1_000_000)
201 }
202 if tokens >= 1_000 {
203 return fmt.Sprintf("%.1fK", float64(tokens)/1_000)
204 }
205 return fmt.Sprintf("%d", tokens)
206}
207
208// printContextInfo imprime informações detalhadas de um contexto
209func (h *ContextHandler) printContextInfo(ctx *ctxmgr.FileContext, detailed bool) {

Callers 7

telemetryPartsMethod · 0.85
pruneCompressionStoreMethod · 0.85
emitSessionSummaryMethod · 0.85
printTokenCostFeedbackFunction · 0.85
TestFormatTokenCountFunction · 0.85
handleShowAttachedMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatTokenCountFunction · 0.68