mirror of https://github.com/kiwix/libkiwix.git
Fix: autodetect proper directories to format
This commit is contained in:
parent
de7fa771fc
commit
f61fc07121
|
@ -1,17 +1,12 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
# Print usage() if no argument given
|
# Compute 'src' path
|
||||||
if [ $# -eq 0 ]
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
then
|
REPO_DIR=$(readlink -f "$SCRIPT_DIR"/..)
|
||||||
echo "./format_code.sh MY_DIR_TO_FORMAT"
|
DIRS="$REPO_DIR/src $REPO_DIR/include"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Retrieve directory to parse
|
|
||||||
DIR=$1
|
|
||||||
|
|
||||||
# Apply formating to all *.cpp and *.h files
|
# Apply formating to all *.cpp and *.h files
|
||||||
for FILE in `find "$DIR" -name '*.h' -o -name '*.cpp'`
|
for FILE in $(find $DIRS -name '*.h' -o -name '*.cpp')
|
||||||
do
|
do
|
||||||
echo $FILE
|
echo $FILE
|
||||||
clang-format -i -style=file "$FILE"
|
clang-format -i -style=file "$FILE"
|
||||||
|
|
Loading…
Reference in New Issue