|
@@ -30,6 +30,7 @@ OPTIONS
|
30
|
30
|
-u --autoupload PIO Upload using the MOTHERBOARD environment.
|
31
|
31
|
-v --verbose Extra output for debugging.
|
32
|
32
|
-s --silent Silence build output from PlatformIO.
|
|
33
|
+ -d --default Restore to defaults before applying configs.
|
33
|
34
|
|
34
|
35
|
env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
|
35
|
36
|
"
|
|
@@ -44,6 +45,7 @@ shopt -s extglob nocasematch
|
44
|
45
|
|
45
|
46
|
# Matching patterns
|
46
|
47
|
ISNUM='^[0-9]+$'
|
|
48
|
+ISRST='^(restore)_'
|
47
|
49
|
ISCMD='^(restore|opt|exec|use|pins|env)_'
|
48
|
50
|
ISEXEC='^exec_'
|
49
|
51
|
ISCONT='\\ *$'
|
|
@@ -53,9 +55,10 @@ TESTENV='-'
|
53
|
55
|
CHOICE=0
|
54
|
56
|
DEBUG=0
|
55
|
57
|
|
56
|
|
-while getopts 'abhmrsuvyn:t:-:' OFLAG; do
|
|
58
|
+while getopts 'abdhmrsuvyn:t:-:' OFLAG; do
|
57
|
59
|
case "${OFLAG}" in
|
58
|
60
|
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
|
|
61
|
+ d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
59
|
62
|
h) EXIT_USAGE=1 ;;
|
60
|
63
|
m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
61
|
64
|
n) case "$OPTARG" in
|
|
@@ -88,6 +91,7 @@ while getopts 'abhmrsuvyn:t:-:' OFLAG; do
|
88
|
91
|
silent) SILENT_FLAG="-s" ;;
|
89
|
92
|
make) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
90
|
93
|
debug|verbose) DEBUG=1 ; bugout "Debug ON" ;;
|
|
94
|
+ default) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
91
|
95
|
build) case "$OVAL" in
|
92
|
96
|
''|y|yes) BUILD_YES='Y' ;;
|
93
|
97
|
n|no) BUILD_YES='N' ;;
|
|
@@ -283,6 +287,11 @@ if [[ $CHOICE == 0 ]]; then
|
283
|
287
|
fi
|
284
|
288
|
|
285
|
289
|
#
|
|
290
|
+# Restore to defaults if requested
|
|
291
|
+#
|
|
292
|
+((DL_DEFAULTS)) && use_example_configs
|
|
293
|
+
|
|
294
|
+#
|
286
|
295
|
# Run the specified test lines
|
287
|
296
|
#
|
288
|
297
|
echo -ne "\033[0;33m"
|
|
@@ -303,6 +312,7 @@ echo "$OUT" | {
|
303
|
312
|
}
|
304
|
313
|
((IND == CHOICE)) && {
|
305
|
314
|
GOTX=1
|
|
315
|
+ [[ -n $DL_DEFAULTS && $LINE =~ $ISRST ]] && LINE="use_example_configs"
|
306
|
316
|
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' )
|
307
|
317
|
[[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; }
|
308
|
318
|
}
|