1+ [ ![ GitHub Workflow Status (branch)] ( https://img.shields.io/github/actions/workflow/status/go-xlan/clang-format/release.yml?branch=main&label=BUILD )] ( https://github.com/go-xlan/clang-format/actions/workflows/release.yml?query=branch%3Amain )
2+ [ ![ GoDoc] ( https://pkg.go.dev/badge/github.com/go-xlan/clang-format )] ( https://pkg.go.dev/github.com/go-xlan/clang-format )
3+ [ ![ Coverage Status] ( https://img.shields.io/coveralls/github/go-xlan/clang-format/main.svg )] ( https://coveralls.io/github/go-xlan/clang-format?branch=main )
4+ [ ![ Supported Go Versions] ( https://img.shields.io/badge/Go-1.22-lightgrey.svg )] ( https://go.dev/ )
5+ [ ![ GitHub Release] ( https://img.shields.io/github/release/go-xlan/clang-format.svg )] ( https://github.com/go-xlan/clang-format/releases )
6+ [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/go-xlan/clang-format )] ( https://goreportcard.com/report/github.com/go-xlan/clang-format )
7+
18# clang-format
29
3- Go wrapper for clang-format with Protocol Buffers formatting capabilities.
10+ Go package for clang-format with Protocol Buffers and C/C++ batch formatting capabilities.
411
512---
613
14+ <!-- TEMPLATE (EN) BEGIN: LANGUAGE NAVIGATION -->
715## CHINESE README
816
917[ 中文说明] ( README.zh.md )
18+ <!-- TEMPLATE (EN) END: LANGUAGE NAVIGATION -->
1019
1120## Key Features
1221
13- 🎯 ** Intelligent Proto Formatting** : Smart clang-format wrapper with Google style defaults
14- ⚡ ** Dual Operation Modes** : Both preview (DryRun) and in-place formatting support
22+ 🎯 ** Intelligent Proto Formatting** : Smart clang-format package with Google style defaults
23+ ⚡ ** Two Operation Modes** : Both preview (DryRun) and in-place formatting support
1524🔄 ** Batch Processing** : Recursive project-wide .proto file formatting
1625🌍 ** Configurable Styles** : Customizable formatting styles with JSON configuration
1726📋 ** Comprehensive Logging** : Detailed operation logs with structured output
1827
19- ## Install
28+ ## Installation
29+
30+ ### Get the Package
2031
2132``` bash
22- go install github.com/go-xlan/clang-format@latest
33+ go get github.com/go-xlan/clang-format@latest
34+ ```
35+
36+ ### Get CLI Command
37+
38+ ``` bash
39+ go install github.com/go-xlan/clang-format/cmd/clang-format-batch@latest
2340```
2441
2542## Prerequisites
2643
27- Install clang-format on your system :
44+ Setup clang-format as requirement :
2845
2946``` bash
3047# macOS
@@ -37,7 +54,25 @@ sudo apt-get install clang-format
3754clang-format --version
3855```
3956
40- ## Usage
57+ ## Quick Start
58+
59+ ### Command Line Usage
60+
61+ ``` bash
62+ # Format all .proto files in current project
63+ clang-format-batch --extensions=" .proto"
64+
65+ # Format C/C++ files
66+ clang-format-batch --extensions=" .c,.cpp,.h"
67+
68+ # Format multiple file types
69+ clang-format-batch --extensions=" .proto,.c,.cpp,.h"
70+
71+ # Use short flag
72+ clang-format-batch -e " .proto,.cc,.hh"
73+ ```
74+
75+ ## Library Usage
4176
4277### Protocol Buffers Formatting (Primary Use Case)
4378
@@ -97,7 +132,7 @@ must.Done(clangformat.Format(execConfig, "example.cpp", style))
97132
98133- ` NewStyle() ` - Creates default Google-based style configuration
99134- ` DryRun(config, path, style) ` - Preview formatting without file modification
100- - ` Format(config, path, style) ` - Apply formatting directly to file
135+ - ` Format(config, path, style) ` - Use formatting on file
101136
102137### protoformat Package
103138
@@ -111,13 +146,14 @@ must.Done(clangformat.Format(execConfig, "example.cpp", style))
111146``` go
112147type Style struct {
113148 BasedOnStyle string // "Google", "LLVM", "Chromium", etc.
114- IndentWidth int // Number of spaces for indentation
149+ IndentWidth int // Count of spaces for indentation
115150 ColumnLimit int // Maximum line length (0 = no limit)
116- AlignConsecutiveAssignments bool // Align assignments at equal signs
151+ AlignConsecutiveAssignments bool // Align assignments at assignment signs
117152}
118153```
119154
120155<!-- TEMPLATE (EN) BEGIN: STANDARD PROJECT FOOTER -->
156+ <!-- VERSION 2025-09-06 04:53:24.895249 +0000 UTC -->
121157
122158## 📄 License
123159
@@ -132,26 +168,26 @@ Contributions are welcome! Report bugs, suggest features, and contribute code:
132168- 🐛 ** Found a bug?** Open an issue on GitHub with reproduction steps
133169- 💡 ** Have a feature idea?** Create an issue to discuss the suggestion
134170- 📖 ** Documentation confusing?** Report it so we can improve
135- - 🚀 ** Need new features?** Share your use cases to help us understand requirements
136- - ⚡ ** Performance issue?** Help us optimize by reporting slow operations
171+ - 🚀 ** Need new features?** Share the use cases to help us understand requirements
172+ - ⚡ ** Performance issue?** Help us optimize through reporting slow operations
137173- 🔧 ** Configuration problem?** Ask questions about complex setups
138- - 📢 ** Follow project progress?** Watch the repo for new releases and features
139- - 🌟 ** Success stories?** Share how this package improved your workflow
140- - 💬 ** General feedback ?** All suggestions and comments are welcome
174+ - 📢 ** Follow project progress?** Watch the repo to get new releases and features
175+ - 🌟 ** Success stories?** Share how this package improved the workflow
176+ - 💬 ** Feedback ?** We welcome suggestions and comments
141177
142178---
143179
144180## 🔧 Development
145181
146182New code contributions, follow this process:
147183
148- 1 . ** Fork** : Fork the repo on GitHub (using the webpage interface ).
184+ 1 . ** Fork** : Fork the repo on GitHub (using the webpage UI ).
1491852 . ** Clone** : Clone the forked project (` git clone https://github.com/yourname/repo-name.git ` ).
1501863 . ** Navigate** : Navigate to the cloned project (` cd repo-name ` )
1511874 . ** Branch** : Create a feature branch (` git checkout -b feature/xxx ` ).
152- 5 . ** Code** : Implement your changes with comprehensive tests
188+ 5 . ** Code** : Implement the changes with comprehensive tests
1531896 . ** Testing** : (Golang project) Ensure tests pass (` go test ./... ` ) and follow Go code style conventions
154- 7 . ** Documentation** : Update documentation for user -facing changes and use meaningful commit messages
190+ 7 . ** Documentation** : Update documentation to support client -facing changes and use significant commit messages
1551918 . ** Stage** : Stage changes (` git add . ` )
1561929 . ** Commit** : Commit changes (` git commit -m "Add feature xxx" ` ) ensuring backward compatible code
15719310 . ** Push** : Push to the branch (` git push origin feature/xxx ` ).
@@ -163,7 +199,7 @@ Please ensure tests pass and include relevant documentation updates.
163199
164200## 🌟 Support
165201
166- Welcome to contribute to this project by submitting pull requests and reporting issues.
202+ Welcome to contribute to this project via submitting merge requests and reporting issues.
167203
168204** Project Support:**
169205
@@ -172,7 +208,7 @@ Welcome to contribute to this project by submitting pull requests and reporting
172208- 📝 ** Write tech blogs** about development tools and workflows - we provide content writing support
173209- 🌟 ** Join the ecosystem** - committed to supporting open source and the (golang) development scene
174210
175- ** Happy Coding with this package!** 🎉
211+ ** Have Fun Coding with this package!** 🎉
176212
177213<!-- TEMPLATE (EN) END: STANDARD PROJECT FOOTER -->
178214
0 commit comments