-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun-all.sh
More file actions
executable file
·203 lines (188 loc) · 5.1 KB
/
Copy pathrun-all.sh
File metadata and controls
executable file
·203 lines (188 loc) · 5.1 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/bin/bash
# Run All Examples - Validation Script
# Runs all DeepL CLI example scripts for testing and validation
set +e # Don't exit on error, we want to run all examples
echo "=== Running All DeepL CLI Examples ==="
echo "This will run all example scripts and report results."
echo "⚠️ Warning: This will make real API calls and consume quota."
echo
# Check API key first
if ! deepl auth show &>/dev/null; then
echo "❌ Error: API key required to run examples"
echo "Run: deepl auth set-key YOUR_API_KEY"
exit 1
fi
echo "✓ API key configured"
echo
# Parse arguments
STOP_ON_ERROR=false
FAST_MODE=false
for arg in "$@"; do
case $arg in
--stop-on-error)
STOP_ON_ERROR=true
shift
;;
--fast)
FAST_MODE=true
shift
;;
--help)
echo "Usage: ./examples/run-all.sh [OPTIONS]"
echo ""
echo "Options:"
echo " --stop-on-error Stop running examples after first failure"
echo " --fast Skip slow examples (watch mode, git hooks)"
echo " --help Show this help message"
exit 0
;;
esac
done
# List of all examples
EXAMPLES=(
# Core Commands - Translate
"01-basic-translation.sh"
"02-file-translation.sh"
"03-batch-processing.sh"
"04-context-aware-translation.sh"
"05-document-translation.sh"
"06-document-format-conversion.sh"
"07-structured-file-translation.sh"
"08-model-type-selection.sh"
"09-xml-tag-handling.sh"
"10-custom-instructions.sh"
"11-table-output.sh"
"12-cost-transparency.sh"
# Core Commands - Write
"13-write.sh"
"36-write-extended-languages.sh"
# Core Commands - Voice
"14-voice.sh"
# Resources
"15-glossaries.sh"
"33-tm-list.sh"
# Workflow
"16-watch-mode.sh"
"17-git-hooks.sh"
"18-cicd-integration.sh"
"30-sync-basic.sh"
"31-sync-ci.sh"
"32-sync-live-validation.sh"
"34-sync-laravel-php.sh"
# Configuration
"19-configuration.sh"
"20-custom-config-files.sh"
"21-cache.sh"
"22-style-rules.sh"
"35-style-rules-crud.sh"
# Information
"23-usage-monitoring.sh"
"24-languages.sh"
"25-detect.sh"
"26-completion.sh"
# Administration
"27-admin.sh"
# Getting Started
"28-init.sh"
# Advanced
"29-advanced-translate.sh"
)
# Skip slow examples in fast mode
if [ "$FAST_MODE" = true ]; then
echo "ℹ️ Fast mode enabled - skipping slow examples (16, 17)"
echo
EXAMPLES=(
# Core Commands - Translate
"01-basic-translation.sh"
"02-file-translation.sh"
"03-batch-processing.sh"
"04-context-aware-translation.sh"
"05-document-translation.sh"
"06-document-format-conversion.sh"
"07-structured-file-translation.sh"
"08-model-type-selection.sh"
"09-xml-tag-handling.sh"
"10-custom-instructions.sh"
"11-table-output.sh"
"12-cost-transparency.sh"
# Core Commands - Write
"13-write.sh"
"36-write-extended-languages.sh"
# Core Commands - Voice
"14-voice.sh"
# Resources
"15-glossaries.sh"
# Workflow (watch/hooks skipped)
"18-cicd-integration.sh"
"30-sync-basic.sh"
"31-sync-ci.sh"
"32-sync-live-validation.sh"
"34-sync-laravel-php.sh"
# Configuration
"19-configuration.sh"
"20-custom-config-files.sh"
"21-cache.sh"
"22-style-rules.sh"
"35-style-rules-crud.sh"
# Information
"23-usage-monitoring.sh"
"24-languages.sh"
"25-detect.sh"
"26-completion.sh"
# Administration
"27-admin.sh"
# Getting Started
"28-init.sh"
# Advanced
"29-advanced-translate.sh"
)
fi
# Run each example and track results
PASSED=()
FAILED=()
TOTAL=${#EXAMPLES[@]}
CURRENT=0
for script in "${EXAMPLES[@]}"; do
CURRENT=$((CURRENT + 1))
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Running example $CURRENT/$TOTAL: $script"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo
if bash "examples/$script"; then
echo
echo "✅ Example $script passed"
PASSED+=("$script")
else
echo
echo "❌ Example $script failed"
FAILED+=("$script")
if [ "$STOP_ON_ERROR" = true ]; then
echo
echo "Stopping due to --stop-on-error flag"
break
fi
fi
echo
echo
done
# Summary report
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "=== Summary ==="
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo
echo "Total examples: $TOTAL"
echo "Passed: ${#PASSED[@]}"
echo "Failed: ${#FAILED[@]}"
echo
if [ ${#FAILED[@]} -eq 0 ]; then
echo "✅ All examples passed successfully!"
echo
exit 0
else
echo "❌ Some examples failed:"
for script in "${FAILED[@]}"; do
echo " - $script"
done
echo
exit 1
fi