mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 12:13:52 +00:00
Adding nicer format script example
This commit is contained in:
parent
f785046da6
commit
f7d51f6a76
@ -9,13 +9,15 @@ format_file() {
|
||||
file="${1}"
|
||||
case "$file" in
|
||||
*.hpp | *.cpp | .c | *.cc | *.cu | *.h )
|
||||
clang-format -i -style=file -sort-includes "${1}"
|
||||
if git diff-files --quiet -- "${1}" ; then
|
||||
echo "Already formatted: ${1}"
|
||||
else
|
||||
git add "${1}"
|
||||
echo "Reformatting file: ${1}"
|
||||
fi;
|
||||
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
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user