码迷,mamicode.com
首页 > 其他好文 > 详细

使用Astyle格式化代码

时间:2017-12-14 04:05:47      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:ase   details   log   margin   下载   bin   apple   github   strong   

在github中clone了nanomsghttps://github.com/davidmpc/nanomsg.git的源代码,发现代码是google风格,即for、if后大括号没有另起一行,十分不习惯,因此需要改变代码格式。

参考http://blog.csdn.net/i_am_tom/article/details/54375266,在sourceforgehttps://sourceforge.net/projects/astyle/?source=typ_redirect中下载了macos的Astyle的代码,进入build文件夹。

davidma@mac:~/software/astyle$ls

 

LICENSE.md README.md  build      doc        file       src

直接make,在bin中有Astyle的可执行文件。

执行如下命令,既可以让大括号另起一行、switch中case前有一个tab、对文件夹下所有的.c迭代格式化。

davidma@mac:~/software/astyle/build/mac/bin$./AStyle --style=allman --indent-switches --recursive ../../../../../Documents/code/nanomsg/nanomsg/src/*.c

 

使用Astyle格式化代码

标签:ase   details   log   margin   下载   bin   apple   github   strong   

原文地址:http://www.cnblogs.com/elseliving/p/8034896.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!