-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoggle_version.sh
More file actions
executable file
·65 lines (50 loc) · 1.92 KB
/
toggle_version.sh
File metadata and controls
executable file
·65 lines (50 loc) · 1.92 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
64
65
#!/bin/bash
# Script to toggle between ClickIt Pro and ClickIt Lite
# Usage: ./toggle_version.sh [pro|lite]
set -e
VERSION="${1:-pro}" # Default to pro
CLICKIT_APP="Sources/ClickIt/ClickItApp.swift"
CLICKIT_LITE_APP="Sources/ClickIt/Lite/ClickItLiteApp.swift"
if [ "$VERSION" = "lite" ]; then
echo "🔄 Switching to ClickIt Lite..."
# Comment out @main in ClickItApp.swift
if grep -q "^@main" "$CLICKIT_APP"; then
sed -i.bak 's/^@main$/\/\/ @main/' "$CLICKIT_APP"
echo "✅ Commented out @main in ClickItApp.swift"
else
echo "ℹ️ @main already commented in ClickItApp.swift"
fi
# Uncomment @main in ClickItLiteApp.swift
if grep -q "^\/\/ @main" "$CLICKIT_LITE_APP"; then
sed -i.bak 's/^\/\/ @main/@main/' "$CLICKIT_LITE_APP"
echo "✅ Uncommented @main in ClickItLiteApp.swift"
else
echo "ℹ️ @main already uncommented in ClickItLiteApp.swift"
fi
# Clean up backup files
rm -f "$CLICKIT_APP.bak" "$CLICKIT_LITE_APP.bak"
echo "✅ Switched to ClickIt Lite"
elif [ "$VERSION" = "pro" ]; then
echo "🔄 Switching to ClickIt Pro..."
# Uncomment @main in ClickItApp.swift
if grep -q "^\/\/ @main" "$CLICKIT_APP"; then
sed -i.bak 's/^\/\/ @main/@main/' "$CLICKIT_APP"
echo "✅ Uncommented @main in ClickItApp.swift"
else
echo "ℹ️ @main already uncommented in ClickItApp.swift"
fi
# Comment out @main in ClickItLiteApp.swift
if grep -q "^@main" "$CLICKIT_LITE_APP"; then
sed -i.bak 's/^@main$/\/\/ @main/' "$CLICKIT_LITE_APP"
echo "✅ Commented out @main in ClickItLiteApp.swift"
else
echo "ℹ️ @main already commented in ClickItLiteApp.swift"
fi
# Clean up backup files
rm -f "$CLICKIT_APP.bak" "$CLICKIT_LITE_APP.bak"
echo "✅ Switched to ClickIt Pro"
else
echo "❌ Invalid version: $VERSION"
echo "Usage: $0 [pro|lite]"
exit 1
fi