Transfer: https://www.cnblogs.com/jiangxinnju/p/4908575.html
Welcome attention to my social account:
Blog Park Address: http://www.cnblogs.com/jiangxinnju
GitHub Address: https://github.com/jiangxincode
know almost Address: https://www.zhihu.com/people/jiangxinnju
astyle is a code formatting tool, its download address is:
http://sourceforge.net/projects/astyle
Project Address:
http://astyle.sourceforge.net/
Document Description:
http://astyle.sourceforge.net/astyle.html
Basic Commands
astyle --style=ansi main.cs
Formatting directory
All cpp, cs files in the current directory ansi style format, pay attention when the batch file, "% f" should be changed to "%% f"
for /R %f in (*.cpp;*.cs;) do astyle --style=ansi "%f"
Parameter Description:
http://astyle.sourceforge.net/astyle.html
Added to the VS2008, VS2005
- Tools -> External Tools -> Add
- Title: astyle
- Command: AStyle.exe (fill astyle.exe path)
- 参数:--style=allman -N $(ItemDir)$(ItemFileName)$(ItemExt)
- Initial directory: $ (TargetDir)
- Check "Use Initial Catalog"
- Click OK to complete, since you can find "astyle" this one in the Tools menu, and click on it, you can not format the current file.
Added to VS6
- Tools——>Customize——>Tools
- Title: astyle
- Command: AStyle.exe (fill astyle.exe path)
- Parameters: - style = ansi -s4 --suffix = .orig $ (FileName) $ (FileExt)
- Initial directory: $ (FileDir)
- 勾上“Using Output Window”
- Click OK to finish. Later you can find "astyle" this one, click on it, you can not format the current file in the Tools menu.
Added to Ultraedit and UltraStudio
- Advanced -> Configuration Tools -> External Tools -> Add
- Command: AStyle.exe -v --style = ansi -s4 --suffix = .orig "% f" (completed route astyle.exe)
- Optiones: Windows program and select Save Active File.
- Output: 选择output to list box,show dos box 和no replace。
- Click OK to finish. Later you can find "astyle" this one, click on it, you can not format the current file in the Tools menu.
Added to the Source insight
- Options-->Custom Command-->Add
- Command:astyle
- Run "D: \ soft \ astyle \ astyle.exe" --style = ansi -f -p -P -U -v -n -N% f (astyle.exe completed path)
- Output: not selected.
- Control: select pause when done and exit to window.
- source links in output:file, then line
- -->menu
- add to work menu.
- Click OK to finish. Later you can find "astyle" this one, click on it, you can not format the current file in the Work menu.
Further reference may be: integrated in the source insight astyle: https://www.cnblogs.com/xuxm2007/archive/2013/04/06/3002390.html
Console directory batch (astyle.bat)
REM 批量将本目录中的所有C++文件用Astyle进行代码美化操作
REM 设置Astyle命令位置和参数
@echo off
set astyle="astyle.exe"
REM 循环遍历目录
for /r . %%a in (*.cpp;*.c) do %astyle% --style=ansi --pad=oper --unpad=paren -s4 -n "%%a" for /r . %%a in (*.hpp;*.h) do %astyle% --style=ansi --pad=oper --unpad=paren -s4 -n "%%a" REM 删除所有的astyle生成文件 for /r . %%a in (*.orig) do del "%%a" pause
Welcome attention to my social account:
Blog Park Address: http://www.cnblogs.com/jiangxinnju
GitHub Address: https://github.com/jiangxincode
know almost Address: https://www.zhihu.com/people/jiangxinnju
astyle is a code formatting tool, its download address is:
http://sourceforge.net/projects/astyle
Project Address:
http://astyle.sourceforge.net/
Document Description:
http://astyle.sourceforge.net/astyle.html
Basic Commands
astyle --style=ansi main.cs
Formatting directory
All cpp, cs files in the current directory ansi style format, pay attention when the batch file, "% f" should be changed to "%% f"
for /R %f in (*.cpp;*.cs;) do astyle --style=ansi "%f"
Parameter Description:
http://astyle.sourceforge.net/astyle.html
Added to the VS2008, VS2005
- Tools -> External Tools -> Add
- Title: astyle
- Command: AStyle.exe (fill astyle.exe path)
- 参数:--style=allman -N $(ItemDir)$(ItemFileName)$(ItemExt)
- Initial directory: $ (TargetDir)
- Check "Use Initial Catalog"
- Click OK to complete, since you can find "astyle" this one in the Tools menu, and click on it, you can not format the current file.
Added to VS6
- Tools——>Customize——>Tools
- Title: astyle
- Command: AStyle.exe (fill astyle.exe path)
- Parameters: - style = ansi -s4 --suffix = .orig $ (FileName) $ (FileExt)
- Initial directory: $ (FileDir)
- 勾上“Using Output Window”
- Click OK to finish. Later you can find "astyle" this one, click on it, you can not format the current file in the Tools menu.
Added to Ultraedit and UltraStudio
- Advanced -> Configuration Tools -> External Tools -> Add
- Command: AStyle.exe -v --style = ansi -s4 --suffix = .orig "% f" (completed route astyle.exe)
- Optiones: Windows program and select Save Active File.
- Output: 选择output to list box,show dos box 和no replace。
- Click OK to finish. Later you can find "astyle" this one, click on it, you can not format the current file in the Tools menu.
Added to the Source insight
- Options-->Custom Command-->Add
- Command:astyle
- Run "D: \ soft \ astyle \ astyle.exe" --style = ansi -f -p -P -U -v -n -N% f (astyle.exe completed path)
- Output: not selected.
- Control: select pause when done and exit to window.
- source links in output:file, then line
- -->menu
- add to work menu.
- Click OK to finish. Later you can find "astyle" this one, click on it, you can not format the current file in the Work menu.
Further reference may be: integrated in the source insight astyle: https://www.cnblogs.com/xuxm2007/archive/2013/04/06/3002390.html
Console directory batch (astyle.bat)
REM 批量将本目录中的所有C++文件用Astyle进行代码美化操作
REM 设置Astyle命令位置和参数
@echo off
set astyle="astyle.exe"
REM 循环遍历目录
for /r . %%a in (*.cpp;*.c) do %astyle% --style=ansi --pad=oper --unpad=paren -s4 -n "%%a" for /r . %%a in (*.hpp;*.h) do %astyle% --style=ansi --pad=oper --unpad=paren -s4 -n "%%a" REM 删除所有的astyle生成文件 for /r . %%a in (*.orig) do del "%%a" pause