您的位置:首页 > 编程语言

使用astyle格式化代码【脚本】

2016-12-02 11:31 288 查看
astyle使用基础教程 http://cppblog.com/jokes000/articles/158838.html
steps:

(1) apt-get install astyle 或者去主页http://sourceforge.net/projects/astyle下载

(2) astyl.sh 脚本

dir=`pwd`
filelist=`find $dir -type f -name "*.c" -or -name "*.h"`

for file in $filelist
do
astyle --style=ansi --indent=spaces=4 $file
done


(3)把这个脚本放在需要格式化的工程文件夹下,执行即可。

其他常用格式:

astyle --style=ansi --indent=tab
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: