ClaudeCodeのステータスラインをカスタマイズして、お金を使うスリルを体験しましょう!`/statusline`コマンドの設定は以下の通りです。私のアプローチをそのまま使いたい場合は、以下のスクリプトをご利用ください。 #!/bin/bash # ============================================================================ # クロード・コード ステータスパネル - サイバーパンク アスキーアート エディション # ============================================================================ 入力=$(cat) # --[ データ抽出 ]---------------------------------------------------------- cost=$(echo "$input" | jq -r '.cost.total_cost_usd // 0 | . * 100 | floor / 100') lines_add=$(echo "$input" | jq -r '.cost.total_lines_added // 0') lines_del=$(echo "$input" | jq -r '.cost.total_lines_removed // 0') api_ms=$(echo "$input" | jq -r '.cost.total_api_duration_ms // 0') model=$(echo "$input" | jq -r '.model.display_name // "—"') # --[ 時刻形式 ]----------------------------------------------------------------- api_s=$((api_ms / 1000)) # --[ ANSI カラーコード ]----------------------------------------------------------------- # エルメスの配色 BG_HERMES='\033[48;5;29m' FG_HERMES_GREEN='\033[38;5;29m' FG_HERMES_ORANGE='\033[38;5;208m' FG_WHITE='\033[38;5;255m' FG_BLACK='\033[38;5;232m' FG_GRAY='\033[38;5;245m' 太字='\033[1m' リセット='\033[0m' # --[ サイバーパンク アスキーパネル ]------------------------------------------------- # 固定幅 26 文字 W=26 # --[ 行 1: ヘッダー ]-- cwd_name=$(basename "$(echo "$input" | jq -r '.cwd // "CLAUDE"')") ヘッダー=" ░░▒▒▓▓██${cwd_name}██▓▓▒▒░░ " header_len=${#header} パッド=$((W - header_len)) printf "\n" printf "${BG_HERMES}${FG_BLACK}${BOLD}%s%*s${RESET}\n" "$header" $pad "" # --[ 行 2: メトリクス ]-- printf " ${FG_HERMES_ORANGE}💰 \$${コスト}${RESET}" printf "${FG_GRAY}│${RESET}" printf "${FG_HERMES_GREEN}+${lines_add}${RESET} ${FG_HERMES_ORANGE}-${lines_del}${RESET}" printf "${FG_GRAY}│${RESET}" printf "${FG_WHITE}${model}${RESET}" printf "\n" # --[ 行 3: フッター ]-- # トランスクリプトファイルからトークンデータを解析する トランスクリプト=$(echo "$input" | jq -r '.transcript_path // ""') if [[ -n "$transcript" && -f "$transcript" ]]; then in_tokens=$(jq -s '[.[] | select(.type == "assistant") | .message.usage.input_tokens // 0] | add // 0' "$transcript" 2>/dev/null) out_tokens=$(jq -s '[.[] | select(.type == "assistant") | .message.usage.output_tokens // 0] | add // 0' "$transcript" 2>/dev/null) in_tokens=${in_tokens:-0} out_tokens=${out_tokens:-0} それ以外 in_tokens=0 アウトトークン=0 フィ # 書式設定関数 fmt_tokens() { ローカル t=$1 [[ $t -ge 1000000 ]]の場合; echo "$(echo "scale=1; $t / 1000000" | bc)M" elif [[ $t -ge 1000 ]]; その後 echo "$(echo "scale=1; $t / 1000" | bc)k" それ以外 エコー "$t" フィ } in_fmt=$(fmt_tokens $in_tokens) out_fmt=$(fmt_tokens $out_tokens) フッター=" ░▒▓ ↑${in_fmt} ↓${out_fmt} ▓▒░ " footer_len=${#footer} pad_total=$((W - footer_len)) pad_left=$((pad_total / 2)) pad_right=$((pad_total - pad_left)) printf "${BG_HERMES}${FG_BLACK}${BOLD}%*s%s%*s${RESET}\n" $pad_left "" "$footer" $pad_right ""
スレッドを読み込み中
X から元のツイートを取得し、読みやすいビューを準備しています。
通常は数秒で完了しますので、お待ちください。
