Skip to content

Commit 9265810

Browse files
committed
docs: update screenshot
1 parent ccbe48f commit 9265810

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

docs/img/code-review.webp

1.12 MB
Loading

scripts/quick-cp-screenshot.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ FILENAME="${FILENAME%.webp}"
2121
FILENAME="${FILENAME%.png}"
2222

2323
# Find the latest screenshot - check custom location first, then Desktop
24-
LATEST_SCREENSHOT=$(ls -t ~/Documents/Screenshots/Screen*.png ~/Desktop/Screen*.png 2>/dev/null | head -1)
24+
# Check for both WebP and PNG files
25+
LATEST_SCREENSHOT=$(ls -t ~/Documents/Screenshots/*.{webp,png} ~/Desktop/*.{webp,png} 2>/dev/null | head -1)
2526

2627
if [ -z "$LATEST_SCREENSHOT" ]; then
2728
echo "❌ Error: No screenshots found in ~/Documents/Screenshots/ or ~/Desktop/"
@@ -35,15 +36,20 @@ mkdir -p "$PROJECT_ROOT/docs/img"
3536

3637
OUTPUT_FILE="$PROJECT_ROOT/docs/img/$FILENAME.webp"
3738

38-
# Convert PNG to WebP using cwebp (as suggested by lint)
39-
echo "Converting to WebP..."
40-
if ! command -v cwebp &>/dev/null; then
41-
echo "❌ Error: cwebp not found. Install with: brew install webp"
42-
exit 1
39+
# Check if the screenshot is already WebP
40+
if [[ "$LATEST_SCREENSHOT" == *.webp ]]; then
41+
echo "Using existing WebP file..."
42+
cp "$LATEST_SCREENSHOT" "$OUTPUT_FILE"
43+
else
44+
# Convert PNG to WebP using cwebp
45+
echo "Converting PNG to WebP..."
46+
if ! command -v cwebp &>/dev/null; then
47+
echo "❌ Error: cwebp not found. Install with: brew install webp"
48+
exit 1
49+
fi
50+
cwebp "$LATEST_SCREENSHOT" -o "$OUTPUT_FILE" -q 85
4351
fi
4452

45-
cwebp "$LATEST_SCREENSHOT" -o "$OUTPUT_FILE" -q 85
46-
4753
# Remove the original screenshot
4854
rm "$LATEST_SCREENSHOT"
4955

0 commit comments

Comments
 (0)