Skip to content

A shell script that can batch process source code formats.

License

Notifications You must be signed in to change notification settings

zhoupeng6d/code-format

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

code-format

MIT

A shell script that can batch process source code formats. Currently it can delete trailing spaces, convert tab indents to 4 spaces indent, and convert end-of-line from windows style (CRLF) to unix style (LF).

For MacOS

Install gnu-sed first.

brew install gnu-sed

Usage

Format a single file:

$ ./code_format.sh test.cc

A folder:

$ ./code_format.sh test/

Supported formats

When converting a directory, it only looks for the file format listed in format_list.conf, and all other formats will not be converted. You can modify format_list.conf to any you need to convert. Now like this:

$ cat format_list.conf
c
cpp
cc
h
hpp
conf
txt
ini
proto
mk
sh
py

TODO

Convert arbitrary file encoding to UTF-8.

About

A shell script that can batch process source code formats.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages