-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_usage.sh
More file actions
129 lines (112 loc) · 3.65 KB
/
example_usage.sh
File metadata and controls
129 lines (112 loc) · 3.65 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
# LangUI to Shuffle.dev Converter - Example Usage Script
# This script demonstrates how to use the converter
set -e # Exit on error
echo "======================================"
echo "LangUI to Shuffle.dev Converter"
echo "Example Usage Script"
echo "======================================"
echo ""
# Function to display usage information
show_usage() {
echo "Usage examples:"
echo ""
echo "1. Convert all LangUI components:"
echo " python converter.py"
echo ""
echo "2. Convert specific categories:"
echo " python converter.py --categories buttons cards alerts"
echo ""
echo "3. List available categories:"
echo " python converter.py --list"
echo ""
echo "4. Specify output directory:"
echo " python converter.py --output my-components"
echo ""
}
# Function to create a ZIP file for upload
create_zip() {
OUTPUT_DIR="${1:-output}"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
ZIP_NAME="langui-shuffle-${TIMESTAMP}.zip"
if [ -d "$OUTPUT_DIR" ]; then
echo "Creating ZIP file: $ZIP_NAME"
cd "$OUTPUT_DIR"
zip -r "../$ZIP_NAME" . -q
cd ..
echo "✓ ZIP file created: $ZIP_NAME"
echo " Ready to upload to Shuffle.dev!"
else
echo "✗ Output directory not found: $OUTPUT_DIR"
exit 1
fi
}
# Main execution
main() {
# Check if Python is installed
if ! command -v python3 &> /dev/null && ! command -v python &> /dev/null; then
echo "✗ Python is not installed. Please install Python 3.6 or later."
exit 1
fi
# Determine Python command
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
else
PYTHON_CMD="python"
fi
echo "Using Python: $PYTHON_CMD"
echo ""
# Check for command line arguments
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
show_usage
exit 0
fi
# Example 1: List available categories
echo "Step 1: Listing available categories"
echo "-------------------------------------"
$PYTHON_CMD converter.py --list
echo ""
# Example 2: Convert specific categories (buttons and cards)
echo "Step 2: Converting sample categories (buttons and cards)"
echo "--------------------------------------------------------"
$PYTHON_CMD converter.py --categories buttons cards
echo ""
# Example 3: Check the output
echo "Step 3: Checking output structure"
echo "----------------------------------"
if [ -d "output" ]; then
echo "Output directory contents:"
echo ""
echo "output/"
echo "├── shuffle.config.json"
echo "└── components/"
# Count components
if [ -d "output/components" ]; then
COMPONENT_COUNT=$(ls -1 output/components/*.html 2>/dev/null | wc -l)
echo ""
echo "Total components generated: $COMPONENT_COUNT"
fi
else
echo "✗ Output directory not found"
fi
echo ""
# Example 4: Create ZIP file
echo "Step 4: Creating ZIP file for upload"
echo "-------------------------------------"
read -p "Create ZIP file for Shuffle.dev upload? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
create_zip "output"
fi
echo ""
echo "======================================"
echo "Example complete!"
echo ""
echo "Next steps:"
echo "1. Review the generated components in output/"
echo "2. Upload the ZIP file to Shuffle.dev"
echo "3. Use components in your projects!"
echo "======================================"
}
# Run main function with all arguments
main "$@"