Commit 6994b1cf authored by Ben Boeckel's avatar Ben Boeckel
Browse files

c: add a clang formatter

parent 31d7ac9e
kind: "clang-format"
script: "/PATH/TO/format.clang-format"
- ".clang-format"
# This formatter uses the `clang-format` tool to perform
# formatting of files written in C, C++, and other C-like
# languages (CUDA, GLSL, etc.).
# It uses the `clang-format` executable in `$PATH` and checks for
# the existence of the `.clang-format` file as its configuration.
set -e
readonly path="$1"
if ! [ -f "$path" ]; then
echo >&2 'error: could not find file to format: '"$path"
exit 4
if ! which "clang-format" > /dev/null; then
echo >&2 'error: could not find the `clang-format` binary'
exit 3
if ! [ -f ".clang-format" ]; then
echo >&2 'error: the `.clang-format` file is missing'
exit 2
exec clang-format -i "$path"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment