File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change 1818NO_RUN_IF_EMPTY=()
1919if [[ " $OSTYPE " != " darwin" * ]]; then NO_RUN_IF_EMPTY+=(--no-run-if-empty); fi
2020
21- if command -v clang-format-8 > /dev/null ; then
22- CLANG_FORMAT=clang-format-8
21+ if [ -z " $CLANG_FORMAT " ]; then
22+ if command -v clang-format-8 > /dev/null ; then
23+ CLANG_FORMAT=clang-format-8
24+ elif command -v clang-format > /dev/null ; then
25+ CLANG_FORMAT=clang-format
26+ else
27+ >&2 echo " WARNING: Could not find clang-format ( https://clang.llvm.org/docs/ClangFormat.html )."
28+ fi
29+ fi
30+
31+ if [ -z " $PRETTIER " ] && command -v prettier > /dev/null; then
32+ PRETTIER=prettier
2333else
24- CLANG_FORMAT=clang-format
34+ >&2 echo " WARNING: Could not find prettier ( https://prettier.io/ ). "
2535fi
2636
27- for ROOT in provides internals ; do
28- find $ROOT -name ' *.md' -print0 | xargs " ${NO_RUN_IF_EMPTY[@]} " -0 prettier --write --
37+ for ROOT in provides internals; do
38+ [ -z " $PRETTIER " ] || find $ROOT -name ' *.md' -print0 | xargs " ${NO_RUN_IF_EMPTY[@]} " -0 " $PRETTIER " --write --
2939 for SUFFIX in cpp hpp ; do
30- find $ROOT -name " *.$SUFFIX " -print0 | xargs " ${NO_RUN_IF_EMPTY[@]} " -0 $CLANG_FORMAT -i --
40+ [ -z " $CLANG_FORMAT " ] || find $ROOT -name " *.$SUFFIX " -print0 | xargs " ${NO_RUN_IF_EMPTY[@]} " -0 " $CLANG_FORMAT " -i --
3141 done
3242done
3343
34- find . -maxdepth 1 -name ' *.md' -print0 | xargs " ${NO_RUN_IF_EMPTY[@]} " -0 prettier --write --
44+ [ -z " $PRETTIER " ] || find . -maxdepth 1 -name ' *.md' -print0 | xargs " ${NO_RUN_IF_EMPTY[@]} " -0 " $PRETTIER " --write --
You can’t perform that action at this time.
0 commit comments