-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.sh
More file actions
executable file
·63 lines (53 loc) · 1.24 KB
/
Copy pathmain.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Main statusline composer
# Loads modules based on config and combines their output
STATUSLINE_DIR="$HOME/.claude/statusline"
# Color codes (shared across modules)
CYAN='\033[36m'
YELLOW='\033[33m'
GREEN='\033[32m'
BLUE='\033[34m'
RED='\033[31m'
RESET='\033[0m'
# Read JSON input from stdin
input=$(cat)
# Extract common values
dir=$(echo "$input" | jq -r '.workspace.current_dir')
model_id=$(echo "$input" | jq -r '.model.id')
# Load configuration
source "$STATUSLINE_DIR/config.sh"
# Load all module files
for module in "${STATUSLINE_MODULES[@]}"; do
source "$STATUSLINE_DIR/modules/${module}.sh"
done
# Build the statusline by calling each module's function
output=""
separator=""
for module in "${STATUSLINE_MODULES[@]}"; do
case "$module" in
git)
result=$(get_git_status "$dir")
;;
model)
result=$(get_model_name "$model_id")
;;
cost)
result=$(get_session_cost "$input")
;;
context)
result=$(get_context_usage "$input")
;;
warriors)
result=$(get_warriors_game)
;;
*)
result=""
;;
esac
if [ -n "$result" ]; then
output="${output}${separator}${result}"
separator=" | "
fi
done
# Print the final statusline
printf "%b" "$output"