Files
ai-setup/home-configs/claude/statusline-command.sh
vitaly 3dfd7ff034 feat: добавить настройку статусной строки Claude Code
Шаг 6.7 - копирует statusline-command.sh и прописывает statusLine
в settings.json. Показывает user@host, путь, git-ветку, модель и usage%.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 10:17:13 +03:00

20 lines
784 B
Bash

#!/bin/bash
input=$(cat)
cwd=$(echo "$input" | jq -r '.cwd')
model=$(echo "$input" | jq -r '.model.display_name // empty')
five_pct=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty')
week_pct=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')
branch=$(git -C "$cwd" --no-optional-locks symbolic-ref --short HEAD 2>/dev/null)
printf "\033[01;32m%s@%s\033[00m:\033[01;34m%s\033[00m" "$(whoami)" "$(hostname -s)" "$cwd"
[ -n "$branch" ] && printf " \033[01;33m[%s]\033[00m" "$branch"
[ -n "$model" ] && printf " \033[00;36m%s\033[00m" "$model"
if [ -n "$five_pct" ]; then
printf " \033[00;35m5h:$(printf '%.0f' "$five_pct")%%\033[00m"
elif [ -n "$week_pct" ]; then
printf " \033[00;35m7d:$(printf '%.0f' "$week_pct")%%\033[00m"
fi