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