FTXUI/tools/format.sh

28 lines
527 B
Bash
Raw Normal View History

2020-04-20 03:00:37 +08:00
#!/bin/bash
cd "$(dirname "$0")"
cd ..
# Add the license file.
files=$(find ./src ./include ./examples -name "*.hpp" -o -name "*.cpp")
for file in $files
do
if ! grep -q Copyright $file
then
2020-09-06 19:46:56 +08:00
cat $file ./tools/license_headers.cpp > $file.new && mv $file.new $file
2020-04-20 03:00:37 +08:00
fi
done
# Use clang-format.
for file in $files
do
clang-format -i $file
done
2020-05-25 07:34:13 +08:00
exampleList="./doc/example_list.md"
echo "# Examples" > $exampleList
files=$(find ./examples/ -iname "*.cpp")
for f in $files
do
echo "@example $f" >> $exampleList
done