dedupe token plural helper · Entire

dedupe token plural helper

532eb0d·

peyton-alt·3w ago·1 file·+3 added/-10 removed

Sessions

1869a59c64b1View transcript

Changes

1

354 unmodified lines

355
356
357
358
358
359
360
361
361
362
363
364
41 unmodified lines

406
407
408
409
409
410
411
412
413
414
415
416
417
418
419
420
421
422

354 unmodified lines

limitations = append(limitations, "No committed checkpoints found.")
    }
    if report.MissingTokenData > 0 {
        limitations = append(limitations, fmt.Sprintf("%d checkpoint%s did not include token usage.", report.MissingTokenData, pluralSuffix(report.MissingTokenData)))
        limitations = append(limitations, fmt.Sprintf("%d checkpoint%s did not include token usage.", report.MissingTokenData, tokenPluralSuffix(report.MissingTokenData)))
    }
    if report.MetadataReadWarnings > 0 {
        limitations = append(limitations, fmt.Sprintf("%d checkpoint%s had incomplete session metadata; profile used root token summaries or readable sessions where available.", report.MetadataReadWarnings, pluralSuffix(report.MetadataReadWarnings)))
        limitations = append(limitations, fmt.Sprintf("%d checkpoint%s had incomplete session metadata; profile used root token summaries or readable sessions where available.", report.MetadataReadWarnings, tokenPluralSuffix(report.MetadataReadWarnings)))
    }
    if report.Tokens != nil {
        limitations = append(limitations, "Token totals are summed from analyzed checkpoints and may include overlapping checkpoint history; treat them as checkpoint-observed volume, not guaranteed unique session spend.")
    41 unmodified lines

fmt.Fprintln(w)
    fmt.Fprintln(w, "Repeated signals")
    for _, signal := range signals {
        fmt.Fprintf(w, "- %s: %d checkpoint%s", signal.Label, signal.Count, pluralSuffix(signal.Count))
        fmt.Fprintf(w, "- %s: %d checkpoint%s", signal.Label, signal.Count, tokenPluralSuffix(signal.Count))
        if signal.Percent > 0 {
            fmt.Fprintf(w, " (%d%%)", signal.Percent)
        }
        fmt.Fprintln(w)
    }
}

func pluralSuffix(count int) string {
    if count == 1 {
        return ""
    }
    return "s"
}

Mcmd/entire/cli/tokens_profile.go+3/-10