Astyle a key project code formatting C / C ++ code format optimization tools ---- astyle

Code formatting discrepancies:

A team has multiple development, due to the development of different habits, the development of less add spaces, line breaks and so on.

When formatting code, usually the entire document will be formatted, you will find the unknown item to modify the code when submitting.

Astyle formatting tools

Download the official website address: Artistic Style

The following bat file, a key format, all the project files cs:

1 echo off & color 0A
2 ::指定起始文件夹
3 set DIR="F:\Github-Myself\WaveLineTextDemo2"
4 echo DIR=%DIR%
5 
6 for /R %DIR% %%f in (*.cs) do ( 
7     C:\Users\kybs0\Desktop\AStyle_3.1_windows\AStyle\bin\Astyle.exe --style=ansi --indent=spaces=4 --indent-switches --indent-cases --indent-namespaces --break-blocks --pad-oper --unpad-paren --convert-tabs --mode=c %%f
8 )
9 pause

Parameter / R represents needs to traverse subfolders, represents not remove the traverse subfolders
%% F is a variable, like the iterator, but this variable only by a letter, to bring the front %%
brackets is a wildcard, can specify the extension, *. cs cs represents all files

  • Set specify a file path, does not support file names that contain spaces.
  • When the circulation path, the variable name is not supported is greater than one letter names, such as file.

Execution of formatting the output:

Reference links:

Guess you like

Origin www.cnblogs.com/kybs0/p/11310473.html