Commit 456567e
authored
Rg missing features (#49)
* Add ripgrep compatibility features: --files, -d, --stats, -P, markdown type
This PR adds several missing ripgrep flags and improves compatibility with the real rg command.
New Features
--files - List files that would be searched without requiring a pattern
rg --files # List all searchable files
rg --files -t js # List only JavaScript files
rg --files -g '*.txt' # List files matching glob
rg --files -d 2 # List files up to depth 2
-d NUM - Short alias for --max-depth
rg -d 2 pattern # Same as rg --max-depth 2 pattern
--stats - Print search statistics after results
rg --stats pattern
# Output includes: matches, matched lines, files with matches, files searched, bytes searched
-P/--pcre2 - Returns helpful error message (PCRE2 not supported)
rg -P pattern
# Error: rg: PCRE2 is not supported. Use standard regex syntax instead.
-t markdown - Added markdown as alias for md file type
rg -t markdown pattern # Search .md, .markdown, .mdown, .mkd files
Changes
- rg-search.ts: Added listFiles() function for --files mode, stats output
- rg-parser.ts: Added -d alias, --files/--stats flags, -P error handling
- rg-options.ts: Added files and stats boolean options
- file-types.ts: Added markdown type alias
- rg.ts: Updated help text with new flags
Tests
Added 22 new tests covering:
- --files with various filters (type, glob, depth, hidden)
- -d at various depths and combined with filters
- --stats output format and edge cases
- markdown type matching all extensions
- -P/--pcre2 error messages
Test count: 417 rg tests (up from 395)
* tests-galore
* file-types1 parent 9a03f7d commit 456567e
File tree
18 files changed
+3270
-261
lines changed- src/commands
- rg
- imported-tests
- search-engine
18 files changed
+3270
-261
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
88 | | - | |
| 92 | + | |
| 93 | + | |
89 | 94 | | |
90 | | - | |
91 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
92 | 117 | | |
93 | | - | |
94 | | - | |
95 | | - | |
| 118 | + | |
| 119 | + | |
96 | 120 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
101 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
102 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
103 | 199 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
110 | 208 | | |
111 | 209 | | |
112 | | - | |
113 | | - | |
114 | 210 | | |
115 | 211 | | |
| 212 | + | |
| 213 | + | |
116 | 214 | | |
117 | 215 | | |
118 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
119 | 243 | | |
120 | 244 | | |
121 | 245 | | |
| |||
0 commit comments