code format using astyle

script context :

#! /bin/bash

for f in $(find . -name '*.c' -or -name '*.cpp' -or -name '*.h' -type f)
do
astyle --style=kr --indent=tab -p -P -k1 $f
done

# after formate the code,we need to rm '*.orig' files
for f in $(find . -name '*.orig' -type f)
do
rm $f
done

 

effect picture :

原文地址:https://www.cnblogs.com/lianghong881018/p/10097799.html