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}"
|
file="${1}"
|
||||||
case "$file" in
|
case "$file" in
|
||||||
*.hpp | *.cpp | .c | *.cc | *.cu | *.h )
|
*.hpp | *.cpp | .c | *.cc | *.cu | *.h )
|
||||||
clang-format -i -style=file -sort-includes "${1}"
|
if [ -f "${1}" ] ; then
|
||||||
if git diff-files --quiet -- "${1}" ; then
|
clang-format -i -style=file -sort-includes "${1}"
|
||||||
echo "Already formatted: ${1}"
|
if git diff-files --quiet -- "${1}" ; then
|
||||||
else
|
echo "Already nicely formatted: ${1}"
|
||||||
git add "${1}"
|
else
|
||||||
echo "Reformatting file: ${1}"
|
git add "${1}"
|
||||||
fi;
|
echo "Reformatting file: ${1}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user