From 8f89d55e4c48017b7b9b436cea3d6232a8ac51bd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Feb 2026 07:28:28 +0000 Subject: [PATCH] fix(cli): hide quota section in statusline on Linux Quota data requires macOS Keychain for OAuth token retrieval, so it's always unavailable on Linux. Remove the section entirely on non-darwin platforms instead of showing a useless gray dash. https://claude.ai/code/session_01WFViMSBVF4NRgg9igRsqb3 --- commands/cc_statusline.go | 15 +++++++++++---- commands/cc_statusline_test.go | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/commands/cc_statusline.go b/commands/cc_statusline.go index fefb8fb..018ca36 100644 --- a/commands/cc_statusline.go +++ b/commands/cc_statusline.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "os" + "runtime" "strings" "time" @@ -164,8 +165,10 @@ func formatStatuslineOutput(modelName string, sessionCost, dailyCost float64, se parts = append(parts, color.Gray.Sprint("📊 -")) } - // Quota utilization - parts = append(parts, formatQuotaPart(fiveHourUtil, sevenDayUtil)) + // Quota utilization (macOS only - requires Keychain for OAuth token) + if runtime.GOOS == "darwin" { + parts = append(parts, formatQuotaPart(fiveHourUtil, sevenDayUtil)) + } // AI agent time (magenta) - clickable link to user profile if sessionSeconds > 0 { @@ -224,8 +227,12 @@ func formatQuotaPart(fiveHourUtil, sevenDayUtil *float64) string { } func outputFallback() { - quotaPart := wrapOSC8Link(claudeUsageURL, "🚦 -") - fmt.Println(color.Gray.Sprint("🌿 - | 🤖 - | 💰 - | 📊 - | " + quotaPart + " | ⏱️ - | 📈 -%")) + if runtime.GOOS == "darwin" { + quotaPart := wrapOSC8Link(claudeUsageURL, "🚦 -") + fmt.Println(color.Gray.Sprint("🌿 - | 🤖 - | 💰 - | 📊 - | " + quotaPart + " | ⏱️ - | 📈 -%")) + } else { + fmt.Println(color.Gray.Sprint("🌿 - | 🤖 - | 💰 - | 📊 - | ⏱️ - | 📈 -%")) + } } // formatSessionDuration formats seconds into a human-readable duration diff --git a/commands/cc_statusline_test.go b/commands/cc_statusline_test.go index 45aacae..de1c6a0 100644 --- a/commands/cc_statusline_test.go +++ b/commands/cc_statusline_test.go @@ -6,6 +6,7 @@ import ( "net" "os" "path/filepath" + "runtime" "testing" "time" @@ -380,15 +381,23 @@ func (s *CCStatuslineTestSuite) TestFormatStatuslineOutput_WithQuota() { sd := 23.0 output := formatStatuslineOutput("claude-opus-4", 1.23, 4.56, 3661, 75.0, "main", false, &fh, &sd, "", "", "") - assert.Contains(s.T(), output, "5h:45%") - assert.Contains(s.T(), output, "7d:23%") - assert.Contains(s.T(), output, "🚦") + if runtime.GOOS == "darwin" { + assert.Contains(s.T(), output, "5h:45%") + assert.Contains(s.T(), output, "7d:23%") + assert.Contains(s.T(), output, "🚦") + } else { + assert.NotContains(s.T(), output, "🚦") + } } func (s *CCStatuslineTestSuite) TestFormatStatuslineOutput_WithoutQuota() { output := formatStatuslineOutput("claude-opus-4", 1.23, 4.56, 3661, 75.0, "main", false, nil, nil, "", "", "") - assert.Contains(s.T(), output, "🚦 -") + if runtime.GOOS == "darwin" { + assert.Contains(s.T(), output, "🚦 -") + } else { + assert.NotContains(s.T(), output, "🚦") + } } func (s *CCStatuslineTestSuite) TestGetDaemonInfo_PropagatesRateLimitFields() {