Skip to content

Commit a32b631

Browse files
committed
πŸ“ docs: Remove wrong docs link for this hook, add Usage section
1 parent 1207d81 commit a32b631

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# typos-pre-commit-mirror
22

3-
Support `pre-commit <= 3.2.0`.<br>
3+
Mirror of the `typos` pre-commit hook for `pre-commit`. Supports `pre-commit` versions 2.9.2 and later.
44

5-
For example `pre-commit` configs, please see the [pre-commit.md](https://github.com/crate-ci/typos/blob/master/docs/pre-commit.md)
5+
## Usage
66

7+
Add this to your `.pre-commit-config.yaml`:
8+
9+
```yaml
10+
- repo: https://github.com/PFCCLab/typos-pre-commit-mirror.git
11+
rev: v1.29.4
12+
hooks:
13+
- id: typos
14+
args: [--force-exclude]
15+
```

β€Žmirror.pyβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ def main():
2222
# Load pyproject.toml
2323
with open(Path(__file__).parent / "pyproject.toml", "rb") as f:
2424
pyproject = tomli.load(f)
25+
# Load README.md
26+
with open(Path(__file__).parent / "README.md", "r") as f:
27+
readme = f.read()
2528

2629
# θŽ·ε–ε½“ε‰η‰ˆζœ¬ηš„ typos
2730
deps = pyproject["project"]["dependencies"]
@@ -48,8 +51,14 @@ def main():
4851
# Update pyproject.toml
4952
pyproject["project"]["version"] = str(version)
5053
pyproject["project"]["dependencies"] = [f"typos=={version}"]
54+
# Update README.md
55+
readme = readme.replace(str(current_version), str(version))
56+
57+
# Write pyproject.toml and README.md
5158
with open(Path(__file__).parent / "pyproject.toml", "wb") as f:
5259
tomli_w.dump(pyproject, f)
60+
with open(Path(__file__).parent / "README.md", "w") as f:
61+
f.write(readme)
5362

5463
# Commit and tag
5564
subprocess.run(["git", "add", "pyproject.toml"])

0 commit comments

Comments
Β (0)