Warning, file /education/labplot/cl-fmt.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #!/bin/bash 0002 0003 # Variable that will hold the name of the clang-format command 0004 FMT="" 0005 0006 FOLDERS=("src/backend" "src/commonfrontend" "src/kdefrontend" "src/tools" "tests") 0007 0008 # Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent 0009 # that the version number be part of the command. We prefer clang-format if 0010 # that's present, otherwise we check clang-format-13 0011 for clangfmt in clang-format{,-13}; do 0012 if which "$clangfmt" &>/dev/null; then 0013 FMT="$clangfmt" 0014 break 0015 fi 0016 done 0017 0018 # Check if we found a working clang-format 0019 if [ -z "$FMT" ]; then 0020 echo "failed to find clang-format. Please install clang-format version 13 or above" 0021 exit 1 0022 fi 0023 0024 function format() { 0025 # ignore getRSS.h file 0026 for f in $(find $@ -name '*.h' ! -iname 'getRSS.h' -or -name '*.m' -or -name '*.mm' -or -name '*.c' -or -name '*.cpp'); do 0027 echo "format ${f}"; 0028 ${FMT} -i ${f}; 0029 done 0030 0031 echo "~~~ $@ Done ~~~"; 0032 } 0033 0034 # Check all of the arguments first to make sure they're all directories 0035 for dir in ${FOLDERS[@]}; do 0036 if [ ! -d "${dir}" ]; then 0037 echo "${dir} is not a directory"; 0038 else 0039 format ${dir}; 0040 fi 0041 done