diff --git a/README.md b/README.md new file mode 100644 index 0000000..f51af70 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# statusline + +## 显示内容 + +| 组 | 示例 | 说明 | +|---|---|---| +| 模型 + 思考 | `H opus-4.8` | 思考等级(L/M/H/XH)+ 模型名;等级按高低绿→红配色 | +| 上下文 | `8.9%` | 已用上下文百分比,按用量绿→红渐变(80% 纯红) | +| 目录 | `project` | 在项目根显示目录名,否则显示末两级 `parent/current` | +| Git | `main ~15 +595` | 分支 + 改动文件数 + 增删行数(为 0 不显示) | +| 速度 | `↑ 1.2k ↓ 134.4 t/s` | 最近 8 次请求的输入/输出 token 速度 | +| 额度 | `10% - 40% · 1:45` | 5h 已用 - 7 天已用 · 5h 刷新倒计时(越近越红) | + +## 接入 Claude Code + +编辑 `~/.claude/settings.json`,把 `statusLine.command` 指向构建产物(用正斜杠路径): + +```json +{ + "statusLine": { + "type": "command", + "command": "statusline" + } +} +``` diff --git a/src/widgets/rate.rs b/src/widgets/rate.rs index 687cc92..8168e51 100644 --- a/src/widgets/rate.rs +++ b/src/widgets/rate.rs @@ -31,7 +31,7 @@ pub fn render(status: &Status) -> String { /// 把 5h 已用、7 天已用、5h 剩余秒数格式化。供渲染与 `test rate` 预览共用。 pub fn display(five: Option, seven: Option, countdown_secs: Option) -> String { - let mut s = format!("{} / {}", pct(five), pct(seven)); + let mut s = format!("{} - {}", pct(five), pct(seven)); if let Some(secs) = countdown_secs { // 越接近刷新(剩余越少)越红:t = 已过 / 5h。 let t = (FIVE_HOUR_SECS - secs as f64) / FIVE_HOUR_SECS;