Skip to content

Commit cff8cad

Browse files
author
Ed Page
committed
docs: Create a Getting Started
1 parent 7371d92 commit cff8cad

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE)
1919
## Documentation
2020

2121
- [Installation](#install)
22+
- [Getting Started](#getting-started)
2223
- [Reference](docs/reference.md)
2324
- [Comparison with other spell checkers](docs/comparison.md)
2425
- [Benchmarks](benchsuite/runs)
@@ -36,5 +37,57 @@ Or use rust to install:
3637
cargo install typos-cli
3738
```
3839

40+
## Getting Started
41+
42+
Most commonly, you'll either want to see what typos are available with
43+
```bash
44+
typos
45+
```
46+
47+
Or have them fixed
48+
```bash
49+
typos --write-changes
50+
typos -w
51+
```
52+
If there is any ambiguity (multiple possible corrections), `typos` will just report it to the user and move on.
53+
54+
### False-positives
55+
56+
Sometimes, what looks like a typo is intentional, like with people's names, acronyms, or localized content.
57+
58+
To mark an identifier or word as valid, add it your [`_typos.toml`](docs/reference.md) by declaring itself as the valid spelling:
59+
```toml
60+
[default.extend-identifiers]
61+
# *sigh* this just isn't worth the cost of fixing
62+
AttributeIDSupressMenu = "AttributeIDSupressMenu"
63+
64+
[default.extend-words]
65+
# Don't correct the surname "Teh"
66+
teh = "teh"
67+
```
68+
69+
For localized content, you might want to exclude the entire file
70+
```toml
71+
[files]
72+
extend-exclude = ["localized/*.po"]
73+
```
74+
75+
### Integrations
76+
77+
`typos` provides several building blocks for custom integrations
78+
- `-` reads from `stdin`, `--write-changes` will be written to `stdout`
79+
- `--diff` to provide a diff
80+
- `--format json` to get jsonlines with exit code 0 on no errors, code 2 on typos, anything else is an error.
81+
82+
Examples:
83+
```bash
84+
# Read file from stdin, write corrected version to stdout
85+
typos - --write-changes
86+
# Creates a diff of what would change
87+
typos dir/file --diff
88+
# Fully programmatic control
89+
typos dir/file --format json
90+
```
91+
3992
[Crates.io]: https://crates.io/crates/typos-cli
4093
[Documentation]: https://docs.rs/typos

0 commit comments

Comments
 (0)