Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ func printUsageAt(output io.Writer, usage api.ProviderUsage, now time.Time) {
return
}
rows := [][]string{{"NAME", "PLAN", "LIMIT", "WINDOW", "USED", "REMAINING", "RESET", "PACE"}}
accountSeparators := map[int]bool{}
for _, account := range usage.Accounts {
if len(rows) > 1 && (account.Error != nil || len(account.Limits) > 0) {
accountSeparators[len(rows)] = true
}
plan := "-"
if account.Plan != nil && *account.Plan != "" {
plan = *account.Plan
Expand Down Expand Up @@ -228,7 +232,7 @@ func printUsageAt(output io.Writer, usage api.ProviderUsage, now time.Time) {
})
}
}
printTable(output, rows, map[int]bool{4: true, 5: true})
printTable(output, rows, map[int]bool{4: true, 5: true}, accountSeparators)
}

func usagePace(limit api.UsageLimit, now time.Time) string {
Expand Down Expand Up @@ -339,7 +343,7 @@ func formatUsageTimeRemaining(remaining time.Duration) string {
return "in " + value
}

func printTable(output io.Writer, rows [][]string, rightAligned map[int]bool) {
func printTable(output io.Writer, rows [][]string, rightAligned map[int]bool, separatorsBefore map[int]bool) {
widths := make([]int, len(rows[0]))
for _, row := range rows {
for column, value := range row {
Expand All @@ -349,6 +353,9 @@ func printTable(output io.Writer, rows [][]string, rightAligned map[int]bool) {
}
printTableBorder(output, widths, "┌", "┬", "┐")
for index, row := range rows {
if separatorsBefore[index] {
printTableBorder(output, widths, "├", "┼", "┤")
}
fmt.Fprint(output, "│")
for column, value := range row {
padding := widths[column] - utf8.RuneCountInString(value)
Expand Down
1 change: 1 addition & 0 deletions internal/cli/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func TestChatGPTUsageOutputShowsEveryLimitAndPartialErrors(t *testing.T) {
├────────────────────┼──────┼─────────────────────┼─────────┼──────┼───────────┼─────────────────────────────────────┼────────────────────┤
│ person@example.com │ pro │ default │ primary │ 88% │ 12% │ 2026-08-11 09:24 KST (in 4d) │ RUNS OUT in 9h 49m │
│ │ │ GPT-5.3-Codex-Spark │ primary │ 0% │ 100% │ - │ - │
├────────────────────┼──────┼─────────────────────┼─────────┼──────┼───────────┼─────────────────────────────────────┼────────────────────┤
│ other@example.com │ - │ - │ - │ - │ - │ ERROR: ChatGPT usage is unavailable │ - │
└────────────────────┴──────┴─────────────────────┴─────────┴──────┴───────────┴─────────────────────────────────────┴────────────────────┘
`
Expand Down
Loading