xref: /freebsd/contrib/libcbor/clang-format.sh (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
1#!/usr/bin/env bash
2
3# Usage: ./clang-format.sh <extra arguments>
4
5DIRS="src test examples"
6SOURCES=$(find ${DIRS} -name "*.c")
7SOURCES+=" $(find ${DIRS} -name "*.h")"
8SOURCES+=" $(find ${DIRS} -name "*.cpp")"
9
10# TravisCI workaround to use new clang-format while avoiding painful aliasing
11# into the subshell
12if which clang-format-8; then
13    clang-format-8 $@ -style=file -i ${SOURCES}
14else
15    clang-format $@ -style=file -i ${SOURCES}
16fi
17
18