Add .clang-format
Most options are configured to keep most of the current style. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
f21cc6d602
commit
04df6ae311
16
scripts/clang-format.sh
Executable file
16
scripts/clang-format.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
FILES=($(git ls-files '*.[ch]'))
|
||||
|
||||
FMT_OPTS=(
|
||||
"-style=file"
|
||||
"--fallback-style=none"
|
||||
"--Werror"
|
||||
)
|
||||
|
||||
if [[ "$1" = "apply" ]]; then
|
||||
clang-format "${FMT_OPTS[@]}" -i "${FILES[@]}"
|
||||
else
|
||||
clang-format "${FMT_OPTS[@]}" --dry-run "${FILES[@]}"
|
||||
fi
|
Reference in New Issue
Block a user