Show Rust docs cache status
Displays cache statistics for Rust documentation with optional detailed file listing.
/plugin marketplace add lywa1998/self-host-claude-marketplace/plugin install rust-skills@SelfHost--verboseShow the status of cached Rust documentation.
Arguments: $ARGUMENTS
--verbose: Show detailed file listCACHE_DIR="$HOME/.claude/cache/rust-docs"
if [ ! -d "$CACHE_DIR" ]; then
echo "No cache directory found at: $CACHE_DIR"
exit 0
fi
# Count files and size by category
echo "=== Rust Docs Cache Status ==="
echo ""
echo "Location: $CACHE_DIR"
echo ""
for category in std docs.rs releases.rs lib.rs clippy; do
if [ -d "$CACHE_DIR/$category" ]; then
count=$(find "$CACHE_DIR/$category" -name "*.json" | wc -l | tr -d ' ')
size=$(du -sh "$CACHE_DIR/$category" 2>/dev/null | cut -f1)
# Count expired
expired=0
now=$(date -u +%Y-%m-%dT%H:%M:%SZ)
for f in $(find "$CACHE_DIR/$category" -name "*.json"); do
exp=$(jq -r '.meta.expires_at' "$f" 2>/dev/null)
if [[ "$exp" < "$now" ]]; then
((expired++))
fi
done
echo "$category: $count items, $size (expired: $expired)"
fi
done
echo ""
total=$(find "$CACHE_DIR" -name "*.json" | wc -l | tr -d ' ')
total_size=$(du -sh "$CACHE_DIR" 2>/dev/null | cut -f1)
echo "Total: $total items, $total_size"
If --verbose flag is set:
echo ""
echo "=== Cached Items ==="
for f in $(find "$CACHE_DIR" -name "*.json" -type f | sort); do
rel_path=${f#$CACHE_DIR/}
exp=$(jq -r '.meta.expires_at' "$f" 2>/dev/null)
now=$(date -u +%Y-%m-%dT%H:%M:%SZ)
if [[ "$exp" < "$now" ]]; then
status="[EXPIRED]"
else
status="[valid]"
fi
echo "$status $rel_path (expires: $exp)"
done
=== Rust Docs Cache Status ===
Location: ~/.claude/cache/rust-docs
std: 45 items, 1.2M (expired: 3)
docs.rs: 128 items, 4.5M (expired: 12)
releases.rs: 15 items, 320K (expired: 0)
lib.rs: 23 items, 156K (expired: 8)
clippy: 42 items, 890K (expired: 5)
Total: 253 items, 7.1M