You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Exact word matching** (excludes partial matches like "curl" in "libcurl")
132
151
133
-
Use `--case-sensitive` to make the search case-sensitive, or `--partial-match` to allow matching the substring as part of larger words.
152
+
Use `--case-sensitive` to make the search case-sensitive, or `--partial-match` to allow matching the substring as part
153
+
of larger words.
154
+
155
+
**Use Cases:**
156
+
157
+
This command helps writers:
158
+
- Find specific strings across documentation files or pages
159
+
- Search for product names, command names, API methods, or other strings that may need to be updated
160
+
- Understand the number of references and impact of changes across documentation files or pages
161
+
- Identify files that need to be updated when a string needs to be changed
162
+
- Scope work related to specific changes
134
163
135
164
**Basic Usage:**
136
165
@@ -165,8 +194,16 @@ Use `--case-sensitive` to make the search case-sensitive, or `--partial-match` t
165
194
166
195
**Flags:**
167
196
168
-
-`-r, --recursive` - Recursively search all files in subdirectories
169
-
-`-f, --follow-includes` - Follow `.. include::` directives in RST files
197
+
-`-r, --recursive` - Recursively scan directories for RST files. If you do not provide this flag, the tool will only
198
+
search within the top-level RST file or directory. If you do provide this flag, the tool will recursively scan all
199
+
subdirectories for RST files and search across all files.
200
+
-`-f, --follow-includes` - Follow `.. include::` directives in RST files. If you do not provide this flag, the tool
201
+
will search only the top-level RST file or directory. If you do provide this flag, the tool will follow any
202
+
`.. include::` directives in any RST file in the input path and search across all included files. When
203
+
combined with `-r`, the tool will recursively scan all subdirectories for RST files and follow `.. include::` directives
204
+
in all files. If an include filepath is *outside* the input directory, the `-r` flag would not parse it, but the `-f`
205
+
flag would follow the include directive and search the included file. This effectively lets you parse all the files
206
+
that make up a single page, if you start from the page's root `.txt` file.
170
207
-`-v, --verbose` - Show file paths and language breakdown
171
208
-`--case-sensitive` - Make search case-sensitive (default: case-insensitive)
172
209
-`--partial-match` - Allow partial matches within words (default: exact word matching)
@@ -185,7 +222,15 @@ With `-v` flag, also shows:
185
222
186
223
#### `analyze includes`
187
224
188
-
Analyze include directive relationships in RST files to understand file dependencies.
225
+
Analyze `include` directive relationships in RST files to understand file dependencies.
226
+
227
+
**Use Cases:**
228
+
229
+
This command helps writers:
230
+
- Understand the impact of changes to widely-included files
231
+
- Identify circular include dependencies (files included multiple times)
232
+
- Document file relationships for maintenance
233
+
- Plan refactoring of complex include structures
189
234
190
235
**Basic Usage:**
191
236
@@ -230,17 +275,12 @@ Analyze include directive relationships in RST files to understand file dependen
230
275
- Files listed in depth-first traversal order
231
276
- Shows absolute paths to all files
232
277
233
-
**Use Cases:**
234
-
235
-
This command helps writers:
236
-
- Understand the impact of changes to widely-included files
237
-
- Identify circular include dependencies (files included multiple times)
238
-
- Document file relationships for maintenance
239
-
- Plan refactoring of complex include structures
240
-
241
278
**Note on File Counting:**
242
279
243
-
The total file count represents **unique files** discovered through include directives. If a file is included multiple times (e.g., file A includes file C, and file B also includes file C), it is counted only once in the total. However, the tree view will show it in all locations where it appears, with subsequent occurrences marked as circular includes in verbose mode.
280
+
The total file count represents **unique files** discovered through include directives. If a file is included multiple
281
+
times (e.g., file A includes file C, and file B also includes file C), the file is counted only once in the total.
282
+
However, the tree view will show it in all locations where it appears, with subsequent occurrences marked as circular
283
+
includes in verbose mode.
244
284
245
285
### Compare Commands
246
286
@@ -400,7 +440,8 @@ product-dir/
400
440
401
441
**Note on Missing Files:**
402
442
403
-
Files that don't exist in certain versions are reported separately and do not cause errors. This is expected behavior since features may be added or removed across versions.
443
+
Files that don't exist in certain versions are reported separately and do not cause errors. This is expected behavior
444
+
since features may be added or removed across versions.
-**Test pattern**: Compare actual extraction output against expected files
590
629
591
-
**Note**: The `testdata` directory name is special in Go - it's automatically ignored during builds, which is important since it contains non-Go files (`.cpp`, `.rst`, etc.).
630
+
**Note**: The `testdata` directory name is special in Go - it's automatically ignored during builds, which is important
631
+
since it contains non-Go files (`.cpp`, `.rst`, etc.).
592
632
593
633
#### Adding New Tests
594
634
@@ -634,7 +674,8 @@ Tests use a table-driven approach with test fixtures in the `testdata/` director
634
674
635
675
#### Test Conventions
636
676
637
-
- **Relative paths**: Tests use `filepath.Join("..", "..", "..", "testdata")` to reference test data (three levels up from `commands/extract/code-examples/`)
677
+
- **Relative paths**: Tests use `filepath.Join("..", "..", "..", "testdata")` to reference test data (three levels up
678
+
from `commands/extract/code-examples/`)
638
679
- **Temporary directories**: Use `os.MkdirTemp()` for test output, clean up with `defer os.RemoveAll()`
- Resolves to: `/includes/steps-run-mongodb-on-linux.yaml`
1011
1055
1012
-
#### Extracts and Release Files
1056
+
##### Extracts and Release Files
1013
1057
Resolves ref-based includes by searching YAML files:
1014
1058
- Input: `/includes/extracts/install-mongodb.rst`
1015
1059
- Searches: `/includes/extracts-*.yaml` for `ref: install-mongodb`
1016
1060
- Resolves to: The YAML file containing that ref
1017
1061
1018
-
#### Template Variables
1062
+
##### Template Variables
1019
1063
Resolves template variables from YAML replacement sections:
1020
1064
```yaml
1021
1065
replacement:
@@ -1026,7 +1070,8 @@ replacement:
1026
1070
1027
1071
**Source Directory Resolution:**
1028
1072
1029
-
The tool walks up the directory tree to find a directory named "source" or containing a "source" subdirectory. This is used as the base for resolving relative include paths.
1073
+
The tool walks up the directory tree to find a directory named "source" or containing a "source" subdirectory. This is
1074
+
used as the base for resolving relative include paths.
1030
1075
1031
1076
## Internal Packages
1032
1077
@@ -1048,15 +1093,47 @@ The tool normalizes language identifiers to standard file extensions:
1048
1093
1049
1094
| Input | Normalized | Extension |
1050
1095
|-------|-----------|-----------|
1051
-
| `ts` | `typescript` | `.ts` |
1096
+
| `bash` | `bash` | `.sh` |
1097
+
| `c` | `c` | `.c` |
1052
1098
| `c++` | `cpp` | `.cpp` |
1099
+
| `c#` | `csharp` | `.cs` |
1100
+
| `console` | `console` | `.sh` |
1101
+
| `cpp` | `cpp` | `.cpp` |
1102
+
| `cs` | `csharp` | `.cs` |
1103
+
| `csharp` | `csharp` | `.cs` |
1104
+
| `go` | `go` | `.go` |
1053
1105
| `golang` | `go` | `.go` |
1106
+
| `java` | `java` | `.java` |
1054
1107
| `javascript` | `javascript` | `.js` |
1108
+
| `js` | `javascript` | `.js` |
1109
+
| `kotlin` | `kotlin` | `.kt` |
1110
+
| `kt` | `kotlin` | `.kt` |
1111
+
| `php` | `php` | `.php` |
1112
+
| `powershell` | `powershell` | `.ps1` |
1113
+
| `ps1` | `powershell` | `.ps1` |
1114
+
| `ps5` | `ps5` | `.ps1` |
1115
+
| `py` | `python` | `.py` |
1055
1116
| `python` | `python` | `.py` |
1056
-
| `shell` / `sh` | `sh` | `.sh` |
1057
-
| `json` | `json` | `.json` |
1058
-
| `yaml` | `yaml` | `.yaml` |
1059
-
| (none) | `txt` | `.txt` |
1117
+
| `rb` | `ruby` | `.rb` |
1118
+
| `rs` | `rust` | `.rs` |
1119
+
| `ruby` | `ruby` | `.rb` |
1120
+
| `rust` | `rust` | `.rs` |
1121
+
| `scala` | `scala` | `.scala` |
1122
+
| `sh` | `shell` | `.sh` |
1123
+
| `shell` | `shell` | `.sh` |
1124
+
| `swift` | `swift` | `.swift` |
1125
+
| `text` | `text` | `.txt` |
1126
+
| `ts` | `typescript` | `.ts` |
1127
+
| `txt` | `text` | `.txt` |
1128
+
| `typescript` | `typescript` | `.ts` |
1129
+
| (empty string) | `undefined` | `.txt` |
1130
+
| `none` | `undefined` | `.txt` |
1131
+
| (unknown) | (unchanged) | `.txt` |
1132
+
1133
+
**Notes:**
1134
+
- Language identifiers are case-insensitive
1135
+
- Unknown languages are returned unchanged by `NormalizeLanguage()` but map to `.txt` extension
1136
+
- The normalization handles common aliases (e.g., `ts` → `typescript`, `golang` → `go`, `c++` → `cpp`)
1060
1137
1061
1138
## Contributing
1062
1139
@@ -1067,7 +1144,3 @@ When contributing to this project:
1067
1144
3. **Update documentation** - Keep this README up to date with new features
1068
1145
4. **Run tests before committing** - Ensure `go test ./...` passes
1069
1146
5. **Use meaningful commit messages** - Describe what changed and why
0 commit comments