-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·57 lines (48 loc) · 1.52 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.52 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
#!/usr/bin/env bash
# install.sh - Non-Nix installer for claude-usage-statusline
set -euo pipefail
INSTALL_DIR="${INSTALL_DIR:-${HOME}/.local/share/claude-usage-statusline}"
BIN_DIR="${BIN_DIR:-${HOME}/.local/bin}"
echo "claude-usage-statusline installer"
echo "================================="
echo ""
# Check dependencies
missing=()
for cmd in jq curl awk; do
command -v "$cmd" >/dev/null 2>&1 || missing+=("$cmd")
done
if [ ${#missing[@]} -gt 0 ]; then
echo "Missing dependencies: ${missing[*]}"
echo "Please install them first."
exit 1
fi
# Clone or update
if [ -d "$INSTALL_DIR/.git" ]; then
echo "Updating existing installation..."
git -C "$INSTALL_DIR" pull --ff-only
else
if [ -d "$INSTALL_DIR" ]; then
echo "Directory $INSTALL_DIR exists but is not a git repo."
echo "Remove it first or set INSTALL_DIR to a different path."
exit 1
fi
echo "Cloning to $INSTALL_DIR..."
git clone "https://github.com/meros/claude-usage-statusline.git" "$INSTALL_DIR"
fi
# Symlink
mkdir -p "$BIN_DIR"
ln -sf "$INSTALL_DIR/bin/claude-usage" "$BIN_DIR/claude-usage"
chmod +x "$INSTALL_DIR/bin/claude-usage"
echo ""
echo "Installed successfully!"
echo " Binary: $BIN_DIR/claude-usage"
echo ""
# Check PATH
if ! echo "$PATH" | tr ':' '\n' | grep -q "^${BIN_DIR}$"; then
echo "NOTE: $BIN_DIR is not in your PATH."
echo "Add to your shell profile:"
echo " export PATH=\"$BIN_DIR:\$PATH\""
echo ""
fi
echo "To configure Claude Code statusline:"
echo " claude-usage install-hook"