@@ -54,23 +54,34 @@ while test $# -gt 0; do
54
54
exit 0
55
55
;;
56
56
-a|--all)
57
- echo " Formatting all files..."
57
+ echo " WARNING: " -a" will format all the files and can be very slow! Please consider using " -b" instead!"
58
+ echo " Are you sure you want to format all files (y/n)?"
59
+ read continueFormat
58
60
59
- # Generate extension string
60
- # Formatted as -iname *.EXTENSION -o
61
- EXTENSION_STRING=" "
62
- for value in " ${EXTENSIONS[@]} "
63
- do
64
- EXTENSION_STRING=" $EXTENSION_STRING -iname *.$value -o"
65
- done
66
-
67
- # Find all the files that we want to format, and pass them to
68
- # clang-format as arguments
69
- # We remove the last -o flag from the extension string
70
- find $CURR_DIR /../src/ ${EXTENSION_STRING::- 2} \
71
- | xargs $CURR_DIR /clang-format-$CLANG_VERSION -i -style=file
61
+ if [ " $continueFormat " == " n" ]; then
62
+ exit 0
72
63
73
- shift
64
+ elif [ " $continueFormat " == " y" ]; then
65
+ echo " Formatting all files..."
66
+
67
+ # Generate extension string
68
+ # Formatted as -iname *.EXTENSION -o
69
+ EXTENSION_STRING=" "
70
+ for value in " ${EXTENSIONS[@]} "
71
+ do
72
+ EXTENSION_STRING=" $EXTENSION_STRING -iname *.$value -o"
73
+ done
74
+
75
+ # Find all the files that we want to format, and pass them to
76
+ # clang-format as arguments
77
+ # We remove the last -o flag from the extension string
78
+ find $CURR_DIR /../src/ ${EXTENSION_STRING::- 2} \
79
+ | xargs $CURR_DIR /clang-format-$CLANG_VERSION -i -style=file
80
+ shift
81
+ else
82
+ echo " Error: input not recognized"
83
+ exit 1
84
+ fi
74
85
;;
75
86
-b|--branch)
76
87
# Shift the arguents to check for the argument to this flag
0 commit comments