Skip to content

Commit 6246134

Browse files
committed
Add Documentation for swag-fmt Hook
1 parent 7998645 commit 6246134

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

README.md

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
11
# pre-commit-swaggo
2-
Pre-commit hooks for Go projects using https://github.com/swaggo/swag
2+
3+
[pre-commit](https://pre-commit.com/) hooks for Go projects using https://github.com/swaggo/swag
4+
5+
## Usage
6+
7+
Add this to your `.pre-commit-config.yaml` file:
8+
9+
```yaml
10+
repos:
11+
# ... other repos ...
12+
- repo: https://github.com/muya/pre-commit-swaggo
13+
rev: "main"
14+
hooks:
15+
- id: swag-fmt
16+
```
17+
18+
Arguments to `swag` can be passed as `args`.
19+
20+
For example, to pass the `--exclude` flag to `swag fmt`:
21+
22+
```yaml
23+
repos:
24+
# ... other repos ...
25+
- repo: https://github.com/muya/pre-commit-swaggo
26+
rev: "main"
27+
hooks:
28+
- id: swag-fmt
29+
args:
30+
- --exclude ./a/special/file.go
31+
```
32+
33+
## Available Hooks
34+
35+
All of these hooks require [swaggo/swag](https://github.com/swaggo/swag#getting-started) to be installed, and available
36+
in your `$PATH`.
37+
38+
- `swag-fmt` - Runs `swag fmt` on all files in the project.

0 commit comments

Comments
 (0)