Squashed 'libs/cli11/' content from commit dcbcb47

git-subtree-dir: libs/cli11
git-subtree-split: dcbcb4721dda5dab0a56d9faaaee50e6a30f7758
This commit is contained in:
Henry Winkel
2022-09-15 09:51:20 +02:00
commit 147125babf
163 changed files with 38023 additions and 0 deletions

36
scripts/clang-format-pre-commit Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# To use:
# ln -s scripts/clang-format.hook .git/hooks/pre-commit
# Based loosely on https://github.com/andrewseidl/githook-clang-format
format_file() {
file="${1}"
case "$file" in
*.hpp | *.cpp | .c | *.cc | *.cu | *.h )
if [ -f "${1}" ] ; then
clang-format -i -style=file -sort-includes "${1}"
if git diff-files --quiet -- "${1}" ; then
echo "Already nicely formatted: ${1}"
else
git add "${1}"
echo "Reformatting file: ${1}"
fi
fi
;;
*)
;;
esac
}
case "${1}" in
--about )
echo "Runs clang-format on source files"
;;
* )
for file in `git diff-index --cached --name-only HEAD` ; do
format_file "${file}"
done
;;
esac