ccstatusline-usage 2.0.37 → 2.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ccstatusline.js +15 -3
- package/package.json +2 -6
- package/defaults/settings-enhanced.json +0 -73
- package/scripts/context.sh +0 -58
- package/scripts/setup-enhanced.sh +0 -98
- package/scripts/usage.sh +0 -147
package/dist/ccstatusline.js
CHANGED
|
@@ -51450,7 +51450,7 @@ import { execSync as execSync3 } from "child_process";
|
|
|
51450
51450
|
import * as fs5 from "fs";
|
|
51451
51451
|
import * as path4 from "path";
|
|
51452
51452
|
var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
|
|
51453
|
-
var PACKAGE_VERSION = "2.0.
|
|
51453
|
+
var PACKAGE_VERSION = "2.0.39";
|
|
51454
51454
|
function getPackageVersion() {
|
|
51455
51455
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51456
51456
|
return PACKAGE_VERSION;
|
|
@@ -54487,7 +54487,7 @@ class ClaudeSessionIdWidget {
|
|
|
54487
54487
|
}
|
|
54488
54488
|
}
|
|
54489
54489
|
// src/widgets/ApiUsage.tsx
|
|
54490
|
-
import { execSync as execSync8 } from "child_process";
|
|
54490
|
+
import { execSync as execSync8, spawnSync } from "child_process";
|
|
54491
54491
|
import * as fs7 from "fs";
|
|
54492
54492
|
import * as path6 from "path";
|
|
54493
54493
|
var CACHE_FILE = path6.join(process.env.HOME ?? "", ".cache", "ccstatusline-api.json");
|
|
@@ -54531,7 +54531,19 @@ function fetchApiData() {
|
|
|
54531
54531
|
if (!token)
|
|
54532
54532
|
return null;
|
|
54533
54533
|
try {
|
|
54534
|
-
const
|
|
54534
|
+
const curlResult = spawnSync("curl", [
|
|
54535
|
+
"-s",
|
|
54536
|
+
"--max-time",
|
|
54537
|
+
"5",
|
|
54538
|
+
"https://api.anthropic.com/api/oauth/usage",
|
|
54539
|
+
"-H",
|
|
54540
|
+
`Authorization: Bearer ${token}`,
|
|
54541
|
+
"-H",
|
|
54542
|
+
"anthropic-beta: oauth-2025-04-20"
|
|
54543
|
+
], { encoding: "utf8", timeout: 5000 });
|
|
54544
|
+
if (curlResult.error || curlResult.status !== 0)
|
|
54545
|
+
return null;
|
|
54546
|
+
const result = curlResult.stdout;
|
|
54535
54547
|
const data = JSON.parse(result);
|
|
54536
54548
|
let apiData = {};
|
|
54537
54549
|
if (data.five_hour) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccstatusline-usage",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.39",
|
|
4
4
|
"description": "A customizable status line formatter for Claude Code CLI",
|
|
5
5
|
"module": "src/ccstatusline.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
"ccstatusline": "dist/ccstatusline.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"dist/"
|
|
12
|
-
"scripts/usage.sh",
|
|
13
|
-
"scripts/context.sh",
|
|
14
|
-
"scripts/setup-enhanced.sh",
|
|
15
|
-
"defaults/"
|
|
11
|
+
"dist/"
|
|
16
12
|
],
|
|
17
13
|
"scripts": {
|
|
18
14
|
"start": "bun run src/ccstatusline.ts",
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"lines": [
|
|
4
|
-
[
|
|
5
|
-
{
|
|
6
|
-
"id": "session-usage",
|
|
7
|
-
"type": "custom-command",
|
|
8
|
-
"color": "brightBlue",
|
|
9
|
-
"commandPath": "scripts/usage.sh session"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"id": "sep-session-weekly",
|
|
13
|
-
"type": "separator"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"id": "weekly-usage",
|
|
17
|
-
"type": "custom-command",
|
|
18
|
-
"color": "brightBlue",
|
|
19
|
-
"commandPath": "scripts/usage.sh weekly"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"id": "sep-weekly-reset",
|
|
23
|
-
"type": "separator"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"id": "reset-timer",
|
|
27
|
-
"type": "custom-command",
|
|
28
|
-
"color": "brightBlue",
|
|
29
|
-
"commandPath": "scripts/usage.sh reset"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"id": "sep-reset-model",
|
|
33
|
-
"type": "separator"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"id": "model",
|
|
37
|
-
"type": "model",
|
|
38
|
-
"color": "magenta"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"id": "sep-model-chatid",
|
|
42
|
-
"type": "separator"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"id": "chat-id",
|
|
46
|
-
"type": "claude-session-id",
|
|
47
|
-
"color": "cyan"
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
{
|
|
52
|
-
"id": "context-usage",
|
|
53
|
-
"type": "custom-command",
|
|
54
|
-
"color": "blue",
|
|
55
|
-
"commandPath": "scripts/context.sh"
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
[]
|
|
59
|
-
],
|
|
60
|
-
"flexMode": "full-minus-40",
|
|
61
|
-
"compactThreshold": 60,
|
|
62
|
-
"colorLevel": 2,
|
|
63
|
-
"inheritSeparatorColors": false,
|
|
64
|
-
"globalBold": false,
|
|
65
|
-
"powerline": {
|
|
66
|
-
"enabled": false,
|
|
67
|
-
"separators": [""],
|
|
68
|
-
"separatorInvertBackground": [false],
|
|
69
|
-
"startCaps": [],
|
|
70
|
-
"endCaps": [],
|
|
71
|
-
"autoAlign": false
|
|
72
|
-
}
|
|
73
|
-
}
|
package/scripts/context.sh
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
CACHE_FILE="$HOME/.claude/.statusline/context.json"
|
|
4
|
-
|
|
5
|
-
make_bar() {
|
|
6
|
-
local pct="$1"
|
|
7
|
-
local width=15
|
|
8
|
-
local filled=$((pct * width / 100))
|
|
9
|
-
local empty=$((width - filled))
|
|
10
|
-
printf "["
|
|
11
|
-
printf "█%.0s" $(seq 1 "$filled")
|
|
12
|
-
printf "░%.0s" $(seq 1 "$empty")
|
|
13
|
-
printf "]"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
format_tokens() {
|
|
17
|
-
local tokens="$1"
|
|
18
|
-
if [[ $tokens -ge 1000 ]]; then
|
|
19
|
-
echo "$((tokens / 1000))k"
|
|
20
|
-
else
|
|
21
|
-
echo "$tokens"
|
|
22
|
-
fi
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if [[ ! -f "$CACHE_FILE" ]]; then
|
|
26
|
-
BAR=$(make_bar 0)
|
|
27
|
-
echo "Context: $BAR 0k/200k (0%)"
|
|
28
|
-
exit 0
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
INPUT=$(cat "$CACHE_FILE")
|
|
32
|
-
|
|
33
|
-
MAX_TOKENS=$(echo "$INPUT" | jq -r '.context_window_size // empty')
|
|
34
|
-
CURRENT_USAGE=$(echo "$INPUT" | jq -r '.current_usage // empty')
|
|
35
|
-
|
|
36
|
-
if [[ -z "$MAX_TOKENS" || "$MAX_TOKENS" == "null" || -z "$CURRENT_USAGE" || "$CURRENT_USAGE" == "null" ]]; then
|
|
37
|
-
BAR=$(make_bar 0)
|
|
38
|
-
echo "Context: $BAR 0k/200k (0%)"
|
|
39
|
-
exit 0
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
INPUT_TOKENS=$(echo "$INPUT" | jq -r '.current_usage.input_tokens // 0')
|
|
43
|
-
CACHE_CREATE=$(echo "$INPUT" | jq -r '.current_usage.cache_creation_input_tokens // 0')
|
|
44
|
-
CACHE_READ=$(echo "$INPUT" | jq -r '.current_usage.cache_read_input_tokens // 0')
|
|
45
|
-
|
|
46
|
-
CURRENT_TOKENS=$((INPUT_TOKENS + CACHE_CREATE + CACHE_READ))
|
|
47
|
-
|
|
48
|
-
if [[ $MAX_TOKENS -gt 0 ]]; then
|
|
49
|
-
PERCENT=$((CURRENT_TOKENS * 100 / MAX_TOKENS))
|
|
50
|
-
else
|
|
51
|
-
PERCENT=0
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
CURRENT_FMT=$(format_tokens "$CURRENT_TOKENS")
|
|
55
|
-
MAX_FMT=$(format_tokens "$MAX_TOKENS")
|
|
56
|
-
BAR=$(make_bar "$PERCENT")
|
|
57
|
-
|
|
58
|
-
echo "Context: $BAR ${CURRENT_FMT}/${MAX_FMT} (${PERCENT}%)"
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Setup script for ccstatusline-usage enhanced configuration
|
|
3
|
-
# Installs usage scripts and applies enhanced settings
|
|
4
|
-
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
SCRIPT_DIR="$HOME/.local/share/ccstatusline"
|
|
8
|
-
CONFIG_DIR="$HOME/.config/ccstatusline"
|
|
9
|
-
SETTINGS_FILE="$CONFIG_DIR/settings.json"
|
|
10
|
-
|
|
11
|
-
# Find the package directory (where this script is located)
|
|
12
|
-
PKG_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
13
|
-
|
|
14
|
-
echo "Setting up ccstatusline-usage enhanced configuration..."
|
|
15
|
-
|
|
16
|
-
# Create directories
|
|
17
|
-
mkdir -p "$SCRIPT_DIR"
|
|
18
|
-
mkdir -p "$CONFIG_DIR"
|
|
19
|
-
|
|
20
|
-
# Copy scripts
|
|
21
|
-
if [[ -f "$PKG_DIR/scripts/usage.sh" ]]; then
|
|
22
|
-
cp "$PKG_DIR/scripts/usage.sh" "$SCRIPT_DIR/"
|
|
23
|
-
chmod +x "$SCRIPT_DIR/usage.sh"
|
|
24
|
-
echo "✓ Installed usage.sh to $SCRIPT_DIR/"
|
|
25
|
-
else
|
|
26
|
-
echo "✗ usage.sh not found in package"
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
if [[ -f "$PKG_DIR/scripts/context.sh" ]]; then
|
|
31
|
-
cp "$PKG_DIR/scripts/context.sh" "$SCRIPT_DIR/"
|
|
32
|
-
chmod +x "$SCRIPT_DIR/context.sh"
|
|
33
|
-
echo "✓ Installed context.sh to $SCRIPT_DIR/"
|
|
34
|
-
else
|
|
35
|
-
echo "✗ context.sh not found in package"
|
|
36
|
-
exit 1
|
|
37
|
-
fi
|
|
38
|
-
|
|
39
|
-
# Create enhanced settings with correct paths
|
|
40
|
-
cat > "$SETTINGS_FILE" << 'EOF'
|
|
41
|
-
{
|
|
42
|
-
"version": 3,
|
|
43
|
-
"lines": [
|
|
44
|
-
[
|
|
45
|
-
{
|
|
46
|
-
"id": "session-usage",
|
|
47
|
-
"type": "custom-command",
|
|
48
|
-
"color": "brightBlue",
|
|
49
|
-
"commandPath": "$HOME/.local/share/ccstatusline/usage.sh session",
|
|
50
|
-
"timeout": 5000
|
|
51
|
-
},
|
|
52
|
-
{"id": "sep1", "type": "separator"},
|
|
53
|
-
{
|
|
54
|
-
"id": "weekly-usage",
|
|
55
|
-
"type": "custom-command",
|
|
56
|
-
"color": "brightBlue",
|
|
57
|
-
"commandPath": "$HOME/.local/share/ccstatusline/usage.sh weekly",
|
|
58
|
-
"timeout": 5000
|
|
59
|
-
},
|
|
60
|
-
{"id": "sep2", "type": "separator"},
|
|
61
|
-
{
|
|
62
|
-
"id": "reset-timer",
|
|
63
|
-
"type": "custom-command",
|
|
64
|
-
"color": "brightBlue",
|
|
65
|
-
"commandPath": "$HOME/.local/share/ccstatusline/usage.sh reset",
|
|
66
|
-
"timeout": 5000
|
|
67
|
-
},
|
|
68
|
-
{"id": "sep3", "type": "separator"},
|
|
69
|
-
{"id": "model", "type": "model", "color": "magenta"},
|
|
70
|
-
{"id": "sep4", "type": "separator"},
|
|
71
|
-
{"id": "session-id", "type": "claude-session-id", "color": "cyan"}
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
{
|
|
75
|
-
"id": "context-usage",
|
|
76
|
-
"type": "custom-command",
|
|
77
|
-
"color": "blue",
|
|
78
|
-
"commandPath": "$HOME/.local/share/ccstatusline/context.sh",
|
|
79
|
-
"timeout": 5000
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
[]
|
|
83
|
-
],
|
|
84
|
-
"flexMode": "full-minus-40",
|
|
85
|
-
"compactThreshold": 60,
|
|
86
|
-
"colorLevel": 2
|
|
87
|
-
}
|
|
88
|
-
EOF
|
|
89
|
-
|
|
90
|
-
# Expand $HOME in the settings file
|
|
91
|
-
sed -i.bak "s|\$HOME|$HOME|g" "$SETTINGS_FILE" && rm -f "$SETTINGS_FILE.bak"
|
|
92
|
-
|
|
93
|
-
echo "✓ Created enhanced settings at $SETTINGS_FILE"
|
|
94
|
-
echo ""
|
|
95
|
-
echo "Setup complete! Run 'npx ccstatusline-usage' to configure."
|
|
96
|
-
echo ""
|
|
97
|
-
echo "Note: The usage widgets require Anthropic API access."
|
|
98
|
-
echo "Make sure you have valid credentials in ~/.claude/credentials.json"
|
package/scripts/usage.sh
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Cross-platform usage script for ccstatusline-usage
|
|
4
|
-
# Works on both macOS and Linux
|
|
5
|
-
|
|
6
|
-
CACHE_FILE="$HOME/.cache/ccstatusline-api.json"
|
|
7
|
-
LOCK_FILE="$HOME/.cache/ccstatusline-api.lock"
|
|
8
|
-
|
|
9
|
-
# Detect OS for platform-specific commands
|
|
10
|
-
is_macos() {
|
|
11
|
-
[[ "$(uname)" == "Darwin" ]]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
# Get file modification time (seconds since epoch)
|
|
15
|
-
get_mtime() {
|
|
16
|
-
if is_macos; then
|
|
17
|
-
stat -f '%m' "$1" 2>/dev/null
|
|
18
|
-
else
|
|
19
|
-
stat -c '%Y' "$1" 2>/dev/null
|
|
20
|
-
fi
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# Get OAuth token from credentials
|
|
24
|
-
get_token() {
|
|
25
|
-
if is_macos; then
|
|
26
|
-
# macOS: read from keychain
|
|
27
|
-
security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null | jq -r '.claudeAiOauth.accessToken // empty'
|
|
28
|
-
else
|
|
29
|
-
# Linux: read from credentials file
|
|
30
|
-
jq -r '.claudeAiOauth.accessToken // empty' ~/.claude/.credentials.json 2>/dev/null
|
|
31
|
-
fi
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# Parse ISO date to epoch
|
|
35
|
-
parse_iso_date() {
|
|
36
|
-
local iso_date="$1"
|
|
37
|
-
# Remove fractional seconds and Z suffix
|
|
38
|
-
local clean_date="${iso_date%%.*}"
|
|
39
|
-
clean_date="${clean_date%%Z}"
|
|
40
|
-
|
|
41
|
-
if is_macos; then
|
|
42
|
-
TZ=UTC date -j -f "%Y-%m-%dT%H:%M:%S" "$clean_date" "+%s" 2>/dev/null
|
|
43
|
-
else
|
|
44
|
-
# Linux: use date -d with ISO format
|
|
45
|
-
date -d "$clean_date" "+%s" 2>/dev/null
|
|
46
|
-
fi
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
fetch_api() {
|
|
50
|
-
local NOW=$(date +%s)
|
|
51
|
-
|
|
52
|
-
# Use cache if < 180 seconds old
|
|
53
|
-
if [[ -f "$CACHE_FILE" ]]; then
|
|
54
|
-
local MTIME=$(get_mtime "$CACHE_FILE")
|
|
55
|
-
if [[ -n "$MTIME" ]]; then
|
|
56
|
-
local CACHE_AGE=$((NOW - MTIME))
|
|
57
|
-
[[ $CACHE_AGE -lt 180 ]] && return 0
|
|
58
|
-
fi
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# Rate limit: only try API once per 30 seconds
|
|
62
|
-
if [[ -f "$LOCK_FILE" ]]; then
|
|
63
|
-
local LOCK_MTIME=$(get_mtime "$LOCK_FILE")
|
|
64
|
-
if [[ -n "$LOCK_MTIME" ]]; then
|
|
65
|
-
local LOCK_AGE=$((NOW - LOCK_MTIME))
|
|
66
|
-
if [[ $LOCK_AGE -lt 30 ]]; then
|
|
67
|
-
[[ -f "$CACHE_FILE" ]] && return 0
|
|
68
|
-
return 1
|
|
69
|
-
fi
|
|
70
|
-
fi
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
touch "$LOCK_FILE"
|
|
74
|
-
|
|
75
|
-
TOKEN=$(get_token)
|
|
76
|
-
[[ -z "$TOKEN" ]] && return 1
|
|
77
|
-
|
|
78
|
-
RESPONSE=$(curl -s --max-time 5 "https://api.anthropic.com/api/oauth/usage" \
|
|
79
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
80
|
-
-H "anthropic-beta: oauth-2025-04-20" 2>/dev/null)
|
|
81
|
-
[[ -z "$RESPONSE" ]] && return 1
|
|
82
|
-
|
|
83
|
-
# Ensure cache directory exists
|
|
84
|
-
mkdir -p "$(dirname "$CACHE_FILE")"
|
|
85
|
-
echo "$RESPONSE" > "$CACHE_FILE"
|
|
86
|
-
return 0
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
make_bar() {
|
|
90
|
-
local pct="$1"
|
|
91
|
-
local width=15
|
|
92
|
-
local filled=$((pct * width / 100))
|
|
93
|
-
local empty=$((width - filled))
|
|
94
|
-
printf "["
|
|
95
|
-
printf "█%.0s" $(seq 1 "$filled")
|
|
96
|
-
printf "░%.0s" $(seq 1 "$empty")
|
|
97
|
-
printf "]"
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
MODE="${1:-all}"
|
|
101
|
-
|
|
102
|
-
fetch_api || { echo "[API Error]"; exit 1; }
|
|
103
|
-
|
|
104
|
-
case "$MODE" in
|
|
105
|
-
session)
|
|
106
|
-
SESSION=$(jq -r '.five_hour.utilization // empty' "$CACHE_FILE" 2>/dev/null)
|
|
107
|
-
[[ -z "$SESSION" ]] && { echo "[Parse Error]"; exit 1; }
|
|
108
|
-
SESSION_INT=${SESSION%.*}
|
|
109
|
-
SESSION_BAR=$(make_bar "$SESSION_INT")
|
|
110
|
-
echo "Session: $SESSION_BAR ${SESSION}%"
|
|
111
|
-
;;
|
|
112
|
-
weekly)
|
|
113
|
-
WEEKLY=$(jq -r '.seven_day.utilization // empty' "$CACHE_FILE" 2>/dev/null)
|
|
114
|
-
[[ -z "$WEEKLY" ]] && { echo "[Parse Error]"; exit 1; }
|
|
115
|
-
WEEKLY_INT=${WEEKLY%.*}
|
|
116
|
-
WEEKLY_BAR=$(make_bar "$WEEKLY_INT")
|
|
117
|
-
echo "Weekly: $WEEKLY_BAR ${WEEKLY}%"
|
|
118
|
-
;;
|
|
119
|
-
reset)
|
|
120
|
-
RESETS_AT=$(jq -r '.five_hour.resets_at // empty' "$CACHE_FILE" 2>/dev/null)
|
|
121
|
-
[[ -z "$RESETS_AT" ]] && { echo "[Parse Error]"; exit 1; }
|
|
122
|
-
RESET_EPOCH=$(parse_iso_date "$RESETS_AT")
|
|
123
|
-
NOW_EPOCH=$(date -u +%s)
|
|
124
|
-
if [[ -z "$RESET_EPOCH" ]]; then
|
|
125
|
-
echo "[Date Error]"
|
|
126
|
-
exit 1
|
|
127
|
-
fi
|
|
128
|
-
DIFF=$((RESET_EPOCH - NOW_EPOCH))
|
|
129
|
-
if [[ $DIFF -le 0 ]]; then
|
|
130
|
-
echo "Reset now"
|
|
131
|
-
else
|
|
132
|
-
HOURS=$((DIFF / 3600))
|
|
133
|
-
MINUTES=$(((DIFF % 3600) / 60))
|
|
134
|
-
echo "${HOURS}:$(printf '%02d' $MINUTES) hr"
|
|
135
|
-
fi
|
|
136
|
-
;;
|
|
137
|
-
*)
|
|
138
|
-
SESSION=$(jq -r '.five_hour.utilization // empty' "$CACHE_FILE" 2>/dev/null)
|
|
139
|
-
WEEKLY=$(jq -r '.seven_day.utilization // empty' "$CACHE_FILE" 2>/dev/null)
|
|
140
|
-
[[ -z "$SESSION" || -z "$WEEKLY" ]] && { echo "[Parse Error]"; exit 1; }
|
|
141
|
-
SESSION_INT=${SESSION%.*}
|
|
142
|
-
WEEKLY_INT=${WEEKLY%.*}
|
|
143
|
-
SESSION_BAR=$(make_bar "$SESSION_INT")
|
|
144
|
-
WEEKLY_BAR=$(make_bar "$WEEKLY_INT")
|
|
145
|
-
echo "Session: $SESSION_BAR ${SESSION}% | Weekly: $WEEKLY_BAR ${WEEKLY}%"
|
|
146
|
-
;;
|
|
147
|
-
esac
|