pseek 2.5.4__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pseek-3.0.0/PKG-INFO ADDED
@@ -0,0 +1,594 @@
1
+ Metadata-Version: 2.4
2
+ Name: pseek
3
+ Version: 3.0.0
4
+ Summary: Pseek is a Python CLI toolkit to search files, folders, and text
5
+ Author-email: Arian <ariannasiri86@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ArianN8610/pysearch
8
+ Requires-Python: >=3.6
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: click==8.1.8
12
+ Requires-Dist: lark==1.2.2
13
+ Requires-Dist: py7zr==1.0.0
14
+ Requires-Dist: rarfile==4.2
15
+ Requires-Dist: rapidfuzz==3.13.0
16
+ Dynamic: license-file
17
+
18
+ # Pseek
19
+
20
+ Fast and powerful command-line search tool for finding files, directories, and text content.
21
+
22
+ ## Features
23
+
24
+ * Search file names
25
+ * Search directory names
26
+ * Search file contents
27
+ * Search inside archive files
28
+ * Boolean query expressions (`and`, `or`, `not`)
29
+ * Regular expressions
30
+ * Fuzzy matching
31
+ * Whole-word matching
32
+ * Case-sensitive search
33
+ * Archive recursion depth control
34
+ * Extension filters
35
+ * Path filters
36
+ * Size filtering
37
+ * Full path output
38
+ * Highlight matches in output
39
+ * Cross-platform (Linux, macOS, Windows)
40
+
41
+ ## Installation
42
+
43
+ ### Install from PyPI (Recommended)
44
+
45
+ ```bash
46
+ pip install pseek
47
+ ```
48
+
49
+ ### Install from Source
50
+
51
+ ```bash
52
+ git clone https://github.com/ArianN8610/pysearch.git
53
+
54
+ cd pysearch
55
+
56
+ python -m venv venv
57
+
58
+ # Activate virtual environment
59
+
60
+ pip install click==8.1.8 lark==1.2.2 py7zr==1.0.0 rarfile==4.2 rapidfuzz==3.13.0
61
+ ```
62
+
63
+ ## Basic Usage
64
+
65
+ ```bash
66
+ psk <query> [options]
67
+ ```
68
+
69
+ Example:
70
+
71
+ ```bash
72
+ psk "error"
73
+ ```
74
+
75
+ If no search type is specified, Pseek searches:
76
+
77
+ - File names
78
+ - Directory names
79
+ - File contents
80
+
81
+ simultaneously.
82
+
83
+ ## Command Options
84
+
85
+ | Option | Description |
86
+ |----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
87
+ | `--path` | Base directory to search in (default: current directory `.`) |
88
+ | `--file` | Search only in file names |
89
+ | `--directory` | Search only in directory names |
90
+ | `--content` | Search within file contents |
91
+ | `--ext`, `--exclude-ext` | Filter by file extension (e.g., `txt`, `log`) |
92
+ | `--case-sensitive` | Make the search case-sensitive (except when `--expr` is enabled, in which case you can make it case sensitive by putting `c` before term: `c"foo"`) |
93
+ | `--regex` | Use regular expressions to search (except when `--expr` is enabled, in which case you can make it regex by putting `r` before term: `r"foo"`) |
94
+ | `--include`, `--exclude` | Limit search results to specific set of directories or files |
95
+ | `--re-include`, `--re-exclude` | Limit search results to specific directories or files with regex |
96
+ | `--word` | Match the whole word only (except when `--expr` is enabled, in which case you can make it match whole word by putting `w` before term: `w"foo"`) |
97
+ | `--expr` | Enable boolean query expressions. Example: `r"foo.*bar" and ("bar" or "baz") and not "qux"`. Prefixes: `r=regex`, `c=case-sensitive`, `w=whole-word`, `f=fuzzy` |
98
+ | `--timeout` | Stop the search after the specified number of seconds |
99
+ | `--fuzzy` | Enable fuzzy search (Highlighting and counting matches are disabled in this mode if `--word` is not enabled to prevent the program from slowing down). except when `--expr` is enabled, in which case you can make it fuzzy by putting `f` before term: `f"foo"` |
100
+ | `--fuzzy-level` | Fuzzy matching threshold (0-99). Higher values require closer matches (default: `80`) |
101
+ | `--max-size`, `--min-size` | Specify maximum and minimum sizes for files and directories |
102
+ | `--archive` | Enable search within archive files (e.g. `zip`, `rar`, `7z`, `gz`, `bz2`, `xz`, `tar`, `tar.gz`, `tar.bz2`, `tar.xz`) |
103
+ | `--depth` | Maximum nested archive depth. Example: 2 allows searching up to two archive levels |
104
+ | `--arc-ext`, `--arc-exc-ext` | Filter by file extension inside archive files |
105
+ | `--arc-include`, `--arc-exclude` | Limit search results to specific set of directories or files inside archive files |
106
+ | `--arc-max`, `--arc-min` | Specify maximum and minimum sizes for files inside archive files (It doesn't work for directories because their size is zero in archive files) |
107
+ | `--rar-backend` | Path to RAR backend tool (e.g. UnRAR.exe, ...) |
108
+ | `--full-path` | Display full path of files and directories |
109
+ | `--paths-only` | Only show matching file paths for content search |
110
+
111
+ ## Search Types
112
+
113
+ ### Search File Names
114
+
115
+ ```bash
116
+ psk "config" --file
117
+ ```
118
+
119
+ ### Search Directory Names
120
+
121
+ ```bash
122
+ psk "backup" --directory
123
+ ```
124
+
125
+ ### Search File Contents
126
+
127
+ ```bash
128
+ psk "TODO" --content
129
+ ```
130
+
131
+ ### Search Everywhere
132
+
133
+ ```bash
134
+ psk "error"
135
+ ```
136
+
137
+ Equivalent to:
138
+
139
+ ```bash
140
+ psk "error" --file --directory --content
141
+ ```
142
+
143
+ ## Query Modes
144
+
145
+ By default, the query is treated as plain text.
146
+
147
+ Example:
148
+
149
+ ```bash
150
+ psk "hello world"
151
+ ```
152
+
153
+ ### Case Sensitive Search
154
+
155
+ ```bash
156
+ psk "Hello" --case-sensitive
157
+ ```
158
+
159
+ Matches:
160
+
161
+ ```text
162
+ Hello
163
+ ```
164
+
165
+ Does not match:
166
+
167
+ ```text
168
+ hello
169
+ HELLO
170
+ ```
171
+
172
+ ### Whole Word Search
173
+
174
+ ```bash
175
+ psk "cat" --word
176
+ ```
177
+
178
+ Matches:
179
+
180
+ ```text
181
+ cat
182
+ ```
183
+
184
+ Does not match:
185
+
186
+ ```text
187
+ cats
188
+ concatenate
189
+ ```
190
+
191
+ ### Regular Expression Search
192
+
193
+ Enable regex mode:
194
+
195
+ ```bash
196
+ psk "error\d+" --regex
197
+ ```
198
+
199
+ Example matches:
200
+
201
+ ```text
202
+ error1
203
+ error25
204
+ error999
205
+ ```
206
+
207
+ ## Fuzzy Search
208
+
209
+ Fuzzy search allows approximate matching.
210
+
211
+ Example:
212
+
213
+ ```bash
214
+ psk "apple" --fuzzy
215
+ ```
216
+
217
+ Can match:
218
+
219
+ ```text
220
+ appl
221
+ appel
222
+ aple
223
+ ```
224
+
225
+ ### Fuzzy Similarity Threshold
226
+
227
+ ```bash
228
+ psk "apple" --fuzzy --fuzzy-level 90
229
+ ```
230
+
231
+ Range: `0-99`
232
+
233
+ Higher values require closer matches.
234
+
235
+ Examples:
236
+
237
+ | Level | Strictness |
238
+ |-------|-------------|
239
+ | 60 | Loose |
240
+ | 80 | Recommended |
241
+ | 95 | Very strict |
242
+
243
+ Default: `80`
244
+
245
+ ## Expression Queries
246
+
247
+ Expression mode enables logical search expressions.
248
+
249
+ Enable:
250
+
251
+ ```bash
252
+ psk '("error" or "warning") and not "debug"' --expr
253
+ ```
254
+
255
+ ### Supported Operators
256
+
257
+ #### AND
258
+
259
+ ```bash
260
+ psk '"foo" and "bar"' --expr
261
+ ```
262
+
263
+ Both terms must match.
264
+
265
+ #### OR
266
+
267
+ ```bash
268
+ psk '"foo" or "bar"' --expr
269
+ ```
270
+
271
+ At least one term must match.
272
+
273
+ #### NOT
274
+
275
+ ```bash
276
+ psk 'not "foo"' --expr
277
+ ```
278
+
279
+ Exclude matches containing the term.
280
+
281
+ #### PARENTHESES
282
+
283
+ ```bash
284
+ psk '("foo" or "bar") and not "baz"' --expr
285
+ ```
286
+
287
+ Used for grouping expressions.
288
+
289
+ ### Expression Prefixes
290
+
291
+ Each term can have its own search mode.
292
+
293
+ #### Regex
294
+
295
+ ```text
296
+ r"pattern"
297
+ ```
298
+
299
+ Example:
300
+
301
+ ```bash
302
+ psk 'r"error\d+"' --expr
303
+ ```
304
+
305
+ #### Case Sensitive
306
+
307
+ ```text
308
+ c"text"
309
+ ```
310
+
311
+ Example:
312
+
313
+ ```bash
314
+ psk 'c"Error"' --expr
315
+ ```
316
+
317
+ #### Whole Word
318
+
319
+ ```text
320
+ w"text"
321
+ ```
322
+
323
+ Example:
324
+
325
+ ```bash
326
+ psk 'w"cat"' --expr
327
+ ```
328
+
329
+ #### Fuzzy
330
+
331
+ ```text
332
+ f"text"
333
+ ```
334
+
335
+ Example:
336
+
337
+ ```bash
338
+ psk 'f"apple"' --expr
339
+ ```
340
+
341
+ ### Combined Prefixes
342
+
343
+ Prefixes can be combined.
344
+
345
+ Examples:
346
+
347
+ ```text
348
+ rc"text"
349
+ cw"text"
350
+ cf"text"
351
+ wcf"text"
352
+ ```
353
+
354
+ Example:
355
+
356
+ ```bash
357
+ psk 'rc"Error\d+"' --expr
358
+ ```
359
+
360
+ Meaning:
361
+
362
+ - regex
363
+ - case-sensitive
364
+
365
+ simultaneously.
366
+
367
+ Allowed modes: `r`, `c`, `w`, `f`, `rc`, `cr`, `cw`, `wc`, `cf`, `fc`, `wf`, `fw`, `cwf`, `cfw`, `wcf`, `wfc`, `fcw`, `fwc`
368
+
369
+ ## Extension Filters
370
+
371
+ Include only specific extensions:
372
+
373
+ ```bash
374
+ psk "TODO" --ext py --ext js
375
+ ```
376
+
377
+ Exclude extensions:
378
+
379
+ ```bash
380
+ psk "TODO" --exclude-ext exe --exclude-ext dll
381
+ ```
382
+
383
+ ## Path Filters
384
+
385
+ ### Include Paths
386
+
387
+ ```bash
388
+ psk "TODO" \
389
+ --include src \
390
+ --include tests
391
+ ```
392
+
393
+ Only search inside those paths.
394
+
395
+ ### Exclude Paths
396
+
397
+ ```bash
398
+ psk "TODO" \
399
+ --exclude build \
400
+ --exclude .git
401
+ ```
402
+
403
+ Skip those paths.
404
+
405
+ ## Regex Path Filters
406
+
407
+ ### Include
408
+
409
+ ```bash
410
+ psk "TODO" \
411
+ --re-include "src/.*"
412
+ ```
413
+
414
+ ### Exclude
415
+
416
+ ```bash
417
+ psk "TODO" \
418
+ --re-exclude "node_modules|dist"
419
+ ```
420
+
421
+ ## Size Filters
422
+
423
+ Limit search by size.
424
+
425
+ Maximum:
426
+
427
+ ```bash
428
+ psk "TODO" --max-size 100
429
+ ```
430
+
431
+ Only search files/directories up to: `100 MB`
432
+
433
+ Minimum:
434
+
435
+ ```bash
436
+ psk "TODO" --min-size 10
437
+ ```
438
+
439
+ Only search files/directories larger than: `10 MB`
440
+
441
+ ## Archive Search
442
+
443
+ Enable archive support:
444
+
445
+ ```bash
446
+ psk "TODO" --archive
447
+ ```
448
+
449
+ Supported formats: `zip`, `rar`, `7z`, `gz`, `bz2`, `xz`, `tar`, `tar.gz`, `tar.bz2`, `tar.xz`
450
+
451
+ ### Nested Archives
452
+
453
+ Pseek supports recursive archive traversal.
454
+
455
+ Example:
456
+
457
+ ```text
458
+ backup.zip
459
+ └── source.7z
460
+ └── notes.txt
461
+ ```
462
+
463
+ Pseek can search:
464
+
465
+ ```text
466
+ backup.zip::source.7z::notes.txt
467
+ ```
468
+
469
+ ### Archive Depth
470
+
471
+ Limit recursion depth:
472
+
473
+ ```bash
474
+ psk "TODO" --archive --depth 2
475
+ ```
476
+
477
+ Meaning:
478
+
479
+ ```text
480
+ archive level 1
481
+ archive level 2
482
+ ```
483
+
484
+ will be searched.
485
+
486
+ Deeper levels will be skipped.
487
+
488
+ ## Archive Filters
489
+
490
+ ### Extension Filters
491
+
492
+ ```bash
493
+ psk "TODO" --archive --arc-ext py
494
+ ```
495
+
496
+ Only search `.py` files inside archives.
497
+
498
+ ```bash
499
+ psk "TODO" --archive --arc-exc-ext jpg
500
+ ```
501
+
502
+ Exclude `.jpg` files inside archives.
503
+
504
+ ### Path Filters
505
+
506
+ Include:
507
+
508
+ ```bash
509
+ psk "TODO" --archive --arc-include src
510
+ ```
511
+
512
+ Exclude:
513
+
514
+ ```bash
515
+ psk "TODO" --archive --arc-exclude cache
516
+ ```
517
+
518
+ ### Size Filters
519
+
520
+ Maximum:
521
+
522
+ ```bash
523
+ psk "TODO" --archive --arc-max 10
524
+ ```
525
+
526
+ Minimum:
527
+
528
+ ```bash
529
+ psk "TODO" --archive --arc-min 1
530
+ ```
531
+
532
+ Values are in MB.
533
+
534
+ **Note:** Archive directory sizes are usually reported as zero by archive formats, therefore archive size filtering is mainly useful for files.
535
+
536
+ ## RAR Backend
537
+
538
+ RAR archives require an external backend that must be set up.
539
+
540
+ Supported backends include:
541
+
542
+ - UnRAR
543
+ - 7-Zip
544
+ - BSDTar
545
+ - Unar
546
+
547
+ Example:
548
+
549
+ ```bash
550
+ psk "unrar" --rar-backend /usr/bin/unrar
551
+ ```
552
+
553
+ Windows:
554
+
555
+ ```bash
556
+ psk "unrar" --rar-backend "C:\Program Files\WinRAR\UnRAR.exe"
557
+ ```
558
+
559
+ Enter the file type in the query (e.g. `unrar`, `bsdtar`, `unar`, `7z`).
560
+
561
+ ## Output Options
562
+
563
+ ### Show Full Paths
564
+
565
+ ```bash
566
+ psk "TODO" --full-path
567
+ ```
568
+
569
+ ### Paths Only
570
+
571
+ Only display matching file paths:
572
+
573
+ ```bash
574
+ psk "TODO" --content --paths-only
575
+ ```
576
+
577
+ Useful for very large result sets.
578
+
579
+ ## Timeout
580
+
581
+ Stop the search automatically after a specified number of seconds.
582
+
583
+ Example:
584
+
585
+ ```bash
586
+ psk "TODO" --timeout 30
587
+ ```
588
+
589
+ If the search exceeds the limit, it will be terminated.
590
+
591
+ ## Requirements
592
+
593
+ * Python `3.8+`
594
+ * `unrar`, `bsdtar`, `unar` or `7zip` for the [rarfile](https://pypi.org/project/rarfile/) library to support searching inside `.rar` files (optional)