pseek 3.3.1__tar.gz → 3.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pseek
3
- Version: 3.3.1
3
+ Version: 3.4.0
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -28,7 +28,70 @@ Project-URL: Repository, https://github.com/grootle/pseek
28
28
 
29
29
  # Pseek
30
30
 
31
- Fast and powerful command-line search tool for finding files, directories, and text content.
31
+ Fast and powerful command-line search tool for finding files, directories, and text content.
32
+
33
+ ## Table of Contents
34
+
35
+ * [Features](#features)
36
+ * [Installation](#installation)
37
+ * [Install from PyPI](#install-from-pypi-recommended)
38
+ * [Install from Source](#install-from-source)
39
+ * [Basic Usage](#basic-usage)
40
+ * [Command Options Table](#command-options)
41
+ * [Specifying the Root Directory](#specifying-the-root-directory)
42
+ * [Search Types](#search-types)
43
+ * [File Names](#search-file-names)
44
+ * [Directory Names](#search-directory-names)
45
+ * [File Contents](#search-file-contents)
46
+ * [All Types Simultaneously](#search-everywhere)
47
+ * [Query Modes](#query-modes)
48
+ * [Case Sensitive](#case-sensitive-search)
49
+ * [Whole Word](#whole-word-search)
50
+ * [Regular Expression (Regex)](#regular-expression-search)
51
+ * [Fuzzy](#fuzzy-search)
52
+ * [Fuzzy Similarity Threshold](#fuzzy-similarity-threshold)
53
+ * [Expression Queries](#expression-queries)
54
+ * [Operators](#supported-operators)
55
+ * [AND](#and)
56
+ * [OR](#or)
57
+ * [NOT](#not)
58
+ * [PARENTHESES](#parentheses)
59
+ * [Prefixes](#expression-prefixes)
60
+ * [Regex](#regex)
61
+ * [Case Sensitive](#case-sensitive)
62
+ * [Whole Word](#whole-word)
63
+ * [Fuzzy](#fuzzy)
64
+ * [Combined Prefixes](#combined-prefixes)
65
+ * [Automatic Filtering](#automatic-filtering)
66
+ * [Manual Filtering](#manual-filtering)
67
+ * [Globs](#globs)
68
+ * [Extension](#extension-filters)
69
+ * [Path](#path-filters)
70
+ * [Include](#include-paths)
71
+ * [Exclude](#exclude-paths)
72
+ * [Regex Path](#regex-path-filters)
73
+ * [Include](#include)
74
+ * [Exclude](#exclude)
75
+ * [Size](#size-filtering)
76
+ * [Depth](#depth)
77
+ * [Archive Search](#archive-search)
78
+ * [Nested Archives](#nested-archives)
79
+ * [Archive Filters](#archive-filters)
80
+ * [Depth](#archive-depth)
81
+ * [Extension](#extension-filters-1)
82
+ * [Path](#path-filters-1)
83
+ * [Size](#size-filter)
84
+ * [What's RAR Backend, and How to Configure It](#rar-backend)
85
+ * [Output Options](#output-options)
86
+ * [Show Full Paths](#show-full-paths)
87
+ * [Paths Only](#paths-only)
88
+ * [Context](#context)
89
+ * [Timeout](#timeout)
90
+ * [Statistics](#statistics)
91
+ * [Result Statistics](#result-statistics)
92
+ * [Search Statistics](#search-statistics)
93
+ * [Search time](#search-time)
94
+ * [Requirements](#requirements)
32
95
 
33
96
  ## Features
34
97
 
@@ -141,6 +204,7 @@ psk -- --path
141
204
  | `--no-require-git` | When this flag is given, source control ignore files such as .gitignore are respected even if no git repository is present. By default, Pseek will only respect filter rules from source control ignore files when Pseek detects that the search is executed inside a source control repository. For example, when a .git directory is observed |
142
205
  | `--hidden` | Search hidden files and directories. By default, hidden files and directories are skipped. Note that if a hidden file or a directory is whitelisted in an ignore file, then it will be searched even if this flag isn't provided. Similarly if a hidden file or directory is given explicitly as path argument or include option |
143
206
  | `--follow` | Follow symbolic links while traversing directories. This behavior is disabled by default. Symbolic link loops and broken links are automatically skipped. Symbolic links are given explicitly as path argument or include option then they will be searched even if this flag is disabled |
207
+ | `--glob` | Include or exclude files and directories for searching that match the given glob. This always overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match .gitignore globs |
144
208
  | `--archive` | Enable search within archive files (e.g. `zip`, `rar`, `7z`, `gz`, `bz2`, `xz`, `tar`, `tar.gz`, `tar.bz2`, `tar.xz`) |
145
209
  | `--arc-depth` | Limit nested archive to given depth range. By default, there is no limit |
146
210
  | `--arc-ext`, `--arc-exc-ext` | Filter by file extension inside archive files |
@@ -151,7 +215,7 @@ psk -- --path
151
215
  | `--paths-only` | Only show matching file paths for content search |
152
216
  | `--stats` | Show search statistics including result counts and search time |
153
217
 
154
- ## Specifying the root directory
218
+ ## Specifying the Root Directory
155
219
 
156
220
  To search a specific directory, path can be given as a second argument:
157
221
 
@@ -233,7 +297,7 @@ psk error\d+ --regex
233
297
 
234
298
  Example matches: `error1`, `error25`, `error999`
235
299
 
236
- ## Fuzzy Search
300
+ ### Fuzzy Search
237
301
 
238
302
  Fuzzy search allows approximate matching.
239
303
 
@@ -245,7 +309,7 @@ psk apple --fuzzy
245
309
 
246
310
  Can match: `appl`, `appel`, `aple`
247
311
 
248
- ### Fuzzy Similarity Threshold
312
+ #### Fuzzy Similarity Threshold
249
313
 
250
314
  ```bash
251
315
  psk apple --fuzzy --fuzzy-level 90
@@ -361,7 +425,7 @@ Example:
361
425
  psk 'f"apple"' --expr
362
426
  ```
363
427
 
364
- ### Combined Prefixes
428
+ #### Combined Prefixes
365
429
 
366
430
  Prefixes can be combined.
367
431
 
@@ -391,51 +455,86 @@ Allowed modes: `r`, `c`, `w`, `f`, `rc`, `cr`, `cw`, `wc`, `cf`, `fc`, `wf`, `fw
391
455
 
392
456
  > **Note:** Whole word matching and regex matching cannot be used at the same time, because we can use `\b` in regex to enable whole word matching: `r"\btext\b"`
393
457
 
394
- ## Context
458
+ ## Automatic Filtering
395
459
 
396
- Show context lines around each match. The value is specified as `BEFORE:AFTER`:
460
+ Pseek automatically filters files and directories during recursive searches using the same ignore-matching backend and ignore-rule semantics used by [ripgrep](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#automatic-filtering).
397
461
 
398
- ```bash
399
- --context 2 # 2 lines before and after
400
- --context 2:0 # 2 lines before, none after
401
- --context 0:2 # none before, 2 lines after
402
- --context 2:5 # 2 lines before, 5 lines after
403
- --context 2: # 2 lines before, none after
404
- --context :2 # none before, 2 lines after
405
- --context 0 # matching lines only
406
- ```
462
+ By default, Pseek will ignore all of the following:
407
463
 
408
- Nearby matches whose context ranges overlap or directly touch are combined into a single group.
464
+ 1. Files and directories that match glob patterns in these sources:
465
+ * `.gitignore` globs. This includes .gitignore files in parent directories that are part of the same git repository. (Unless the `--no-require-git` flag is given)
466
+ * `.git/info/exclude`
467
+ * Git's global ignore file configured through `core.excludesFile`
468
+ * `.ignore` globs, which take precedence over all gitignore globs when there's a conflict. This includes `.ignore` files in parent directories.
469
+ * Ignore files from parent directories, when applicable (Unless the `--no-ignore-parent` flag is given)
470
+ 2. Binary files for content search. (any file with a NUL byte to be binary)
471
+ 3. Hidden files and directories. (A file or directory is considered hidden if its base name starts with a dot character `.`)
472
+ 4. Symbolic links aren't followed
409
473
 
410
- ## Depth
474
+ All of these things can be toggled using various flags:
411
475
 
412
- Controls how deep the search goes inside directories.
476
+ 1. You can disable all git-related filtering with the `--no-ignore` flag.
477
+ 2. Hidden files and directories can be searched with the `--hidden` flag.
478
+ 3. Symbolic links can be searched with the `--follow` flag.
413
479
 
414
- A depth of `0` means that only base path's immediate contents are searched; subdirectories are not entered.
480
+ For convenience, you can use the `--unrestricted` flag. This flag disables all the automatic filters mentioned above except the filter related to binary files for searching file contents.
481
+
482
+ The ignore rules are interpreted using the same matching and precedence semantics as ripgrep. When ignore files at different directory levels define conflicting rules, rules from a **deeper directory take precedence over rules inherited from its parent directories**.
483
+
484
+ Within the same directory level, ignore sources are applied with the following precedence, from highest to lowest:
415
485
 
416
486
  ```text
417
- project/ ← base directory
418
- ├── file.txt ← depth 0
419
- ├── folder1/ ← depth 0
420
- │ ├── file.txt ← depth 1
421
- │ └── folder2/ ← depth 1
422
- │ └── file.txt ← depth 2
487
+ .ignore
488
+ .gitignore
489
+ .git/info/exclude
490
+ global Git excludes (core.excludesFile)
423
491
  ```
424
492
 
425
- `--depth` can be specified multiple times to search non-contiguous depth ranges:
493
+ ## Manual Filtering
494
+
495
+ ### Globs
496
+
497
+ Filter files and directories using glob patterns. The `--glob` option can be specified multiple times to include or exclude paths from the search.
498
+
499
+ Pseek uses the same Git-style glob syntax and override precedence as [ripgrep](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#manual-filtering-globs).
500
+
501
+ Use a glob without a leading `!` to include matching paths:
426
502
 
427
503
  ```bash
428
- --depth 0 # Direct contents only
429
- --depth 1 # One level inside
430
- --depth 2:4 # Depths 2 through 4
431
- --depth 2 --depth 5:7 # Depths 2 and 5 through 7
432
- --depth :2 # Depths 0 through 2
433
- --depth 3: # Depth 3 and deeper
504
+ # Search only Python files
505
+ psk TODO --glob '*.py'
506
+
507
+ # Search Python and Rust files
508
+ psk TODO --glob '*.py' --glob '*.rs'
434
509
  ```
435
510
 
436
- If `--depth` is not specified, the search has no depth limit.
511
+ Use a leading `!` to exclude matching paths:
512
+
513
+ ```bash
514
+ # Exclude Python files
515
+ psk TODO --glob '!*.py'
516
+
517
+ # Include Python files, but exclude test files
518
+ psk TODO --glob '*.py' --glob '!*.test.py'
519
+ ```
520
+
521
+ > **Note:** The `!` prefix has the opposite meaning from its use in `.gitignore` files. With `--glob`, a pattern without `!` includes matching paths, while a pattern prefixed with `!` excludes them.
437
522
 
438
- ## Extension Filters
523
+ You can provide multiple `--glob` options. When multiple patterns match the same path, **the last matching pattern takes precedence**.
524
+
525
+ ```bash
526
+ # Include Python files, exclude tests, then include a specific test file
527
+ psk TODO \
528
+ --glob '*.py' \
529
+ --glob '!*.test.py' \
530
+ --glob important.test.py
531
+ ```
532
+
533
+ Command-line glob patterns take precedence over Pseek's automatic ignore rules, such as supported `.gitignore`, `.ignore`, Git exclude, and global Git ignore rules.
534
+
535
+ For more details about the ignore rules applied automatically, see [Automatic Filtering](#automatic-filtering).
536
+
537
+ ### Extension Filters
439
538
 
440
539
  Include only specific extensions:
441
540
 
@@ -449,9 +548,9 @@ Exclude extensions:
449
548
  psk TODO --exclude-ext exe --exclude-ext dll
450
549
  ```
451
550
 
452
- ## Path Filters
551
+ ### Path Filters
453
552
 
454
- ### Include Paths
553
+ #### Include Paths
455
554
 
456
555
  ```bash
457
556
  psk TODO \
@@ -461,7 +560,7 @@ psk TODO \
461
560
 
462
561
  Only search inside those paths.
463
562
 
464
- ### Exclude Paths
563
+ #### Exclude Paths
465
564
 
466
565
  ```bash
467
566
  psk TODO \
@@ -473,23 +572,23 @@ Skip those paths.
473
572
 
474
573
  > **Note:** The include and exclude paths will be combined with path argument.
475
574
 
476
- ## Regex Path Filters
575
+ ### Regex Path Filters
477
576
 
478
- ### Include
577
+ #### Include
479
578
 
480
579
  ```bash
481
580
  psk TODO \
482
581
  --re-include src/.*
483
582
  ```
484
583
 
485
- ### Exclude
584
+ #### Exclude
486
585
 
487
586
  ```bash
488
587
  psk TODO \
489
588
  --re-exclude "node_modules|dist"
490
589
  ```
491
590
 
492
- ## Size Filtering
591
+ ### Size Filtering
493
592
 
494
593
  | Syntax | Meaning |
495
594
  | ------------------------- | ------------------------------ |
@@ -526,41 +625,34 @@ Files between `1 MiB` and `10 MiB` will not match.
526
625
 
527
626
  > **Note:** Directory sizes are not calculated recursively. When `--size` is used, directories are automatically excluded from the search results.
528
627
 
529
- ## Automatic filtering
530
-
531
- Pseek automatically filters files and directories during recursive searches using the same ignore-matching backend and ignore-rule semantics used by [ripgrep](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#automatic-filtering).
532
-
533
- By default, Pseek will ignore all of the following:
534
-
535
- 1. Files and directories that match glob patterns in these sources:
536
- * `.gitignore` globs. This includes .gitignore files in parent directories that are part of the same git repository. (Unless the `--no-require-git` flag is given)
537
- * `.git/info/exclude`
538
- * Git's global ignore file configured through `core.excludesFile`
539
- * `.ignore` globs, which take precedence over all gitignore globs when there's a conflict. This includes `.ignore` files in parent directories.
540
- * Ignore files from parent directories, when applicable (Unless the `--no-ignore-parent` flag is given)
541
- 2. Binary files for content search. (any file with a NUL byte to be binary)
542
- 3. Hidden files and directories. (A file or directory is considered hidden if its base name starts with a dot character `.`)
543
- 4. Symbolic links aren't followed
544
-
545
- All of these things can be toggled using various flags:
628
+ ### Depth
546
629
 
547
- 1. You can disable all git-related filtering with the `--no-ignore` flag.
548
- 2. Hidden files and directories can be searched with the `--hidden` flag.
549
- 3. Symbolic links can be searched with the `--follow` flag.
630
+ Controls how deep the search goes inside directories.
550
631
 
551
- For convenience, you can use the `--unrestricted` flag. This flag disables all the automatic filters mentioned above except the filter related to binary files for searching file contents.
632
+ A depth of `0` means that only base path's immediate contents are searched; subdirectories are not entered.
552
633
 
553
- The ignore rules are interpreted using the same matching and precedence semantics as ripgrep. When ignore files at different directory levels define conflicting rules, rules from a **deeper directory take precedence over rules inherited from its parent directories**.
634
+ ```text
635
+ project/ ← base directory
636
+ ├── file.txt ← depth 0
637
+ ├── folder1/ ← depth 0
638
+ │ ├── file.txt ← depth 1
639
+ │ └── folder2/ ← depth 1
640
+ │ └── file.txt ← depth 2
641
+ ```
554
642
 
555
- Within the same directory level, ignore sources are applied with the following precedence, from highest to lowest:
643
+ `--depth` can be specified multiple times to search non-contiguous depth ranges:
556
644
 
557
- ```text
558
- .ignore
559
- .gitignore
560
- .git/info/exclude
561
- global Git excludes (core.excludesFile)
645
+ ```bash
646
+ --depth 0 # Direct contents only
647
+ --depth 1 # One level inside
648
+ --depth 2:4 # Depths 2 through 4
649
+ --depth 2 --depth 5:7 # Depths 2 and 5 through 7
650
+ --depth :2 # Depths 0 through 2
651
+ --depth 3: # Depth 3 and deeper
562
652
  ```
563
653
 
654
+ If `--depth` is not specified, the search has no depth limit.
655
+
564
656
  ## Archive Search
565
657
 
566
658
  Enable archive support:
@@ -571,6 +663,8 @@ psk TODO --archive
571
663
 
572
664
  Supported formats: `zip`, `rar`, `7z`, `gz`, `bz2`, `xz`, `tar`, `tar.gz`, `tar.bz2`, `tar.xz`
573
665
 
666
+ > **Note:** [Automatic filters](#automatic-filtering) and [--glob](#globs) option don't work on archive files
667
+
574
668
  ### Nested Archives
575
669
 
576
670
  Pseek supports nested archives for multi-file archive containers (zip, rar, 7z, tar and compressed tar formats). Nested archive traversal means Pseek can search inside an archive that itself contains other archives (for example `a.zip` containing `b.7z` containing `c.tar.gz`).
@@ -589,6 +683,8 @@ Pseek can search:
589
683
  backup.zip::source.7z::notes.txt
590
684
  ```
591
685
 
686
+ ## Archive Filters
687
+
592
688
  ### Archive Depth
593
689
 
594
690
  The concept of depth in archive is different from `--depth`. Depth in archive is calculated based on nested archives. Each archive that is inside another archive counts as one level of depth.
@@ -610,8 +706,6 @@ Meaning `archive level 3` and `archive level 4` won't be searched.
610
706
 
611
707
  > **Note:** `--arc-depth 0` means perform the search only within this current archive and don't enter nested archives.
612
708
 
613
- ## Archive Filters
614
-
615
709
  ### Extension Filters
616
710
 
617
711
  ```bash
@@ -690,7 +784,23 @@ psk TODO --content --paths-only
690
784
 
691
785
  Useful for very large result sets.
692
786
 
693
- ## Timeout
787
+ ### Context
788
+
789
+ Show context lines around each match. The value is specified as `BEFORE:AFTER`:
790
+
791
+ ```bash
792
+ --context 2 # 2 lines before and after
793
+ --context 2:0 # 2 lines before, none after
794
+ --context 0:2 # none before, 2 lines after
795
+ --context 2:5 # 2 lines before, 5 lines after
796
+ --context 2: # 2 lines before, none after
797
+ --context :2 # none before, 2 lines after
798
+ --context 0 # matching lines only
799
+ ```
800
+
801
+ Nearby matches whose context ranges overlap or directly touch are combined into a single group.
802
+
803
+ ### Timeout
694
804
 
695
805
  Stop the search automatically after a specified number of seconds.
696
806
 
@@ -702,7 +812,7 @@ psk TODO --timeout 0.5
702
812
 
703
813
  If the search exceeds the limit, it will be terminated. Results found before the search is terminated are still displayed.
704
814
 
705
- ## Search Statistics
815
+ ### Statistics
706
816
 
707
817
  Display a summary of the search, including result counts, scanned paths, archive information, and search time.
708
818
 
@@ -730,7 +840,7 @@ Search
730
840
  Search time: 0.128s
731
841
  ```
732
842
 
733
- ### Result statistics
843
+ #### Result Statistics
734
844
 
735
845
  * **Files matched** — Number of files whose names matched the query.
736
846
  * **Directories matched** — Number of directories whose names matched the query.
@@ -738,7 +848,7 @@ Search time: 0.128s
738
848
  * **Lines matched** — Number of lines containing one or more matches.
739
849
  * **Matches** — Total number of matches found in the contents of the files.
740
850
 
741
- ### Search statistics
851
+ #### Search Statistics
742
852
 
743
853
  * **Files scanned** — Number of files examined during the search.
744
854
  * **Archives scanned** — Number of archives processed, including nested archives found inside other archives.
@@ -748,7 +858,7 @@ When `--archive` is enabled, file and directory statistics can also include path
748
858
 
749
859
  `Directories scanned` can be `0` when the search path contains no subdirectories. The root search directory itself isn't counted as a scanned directory.
750
860
 
751
- ### Search time
861
+ #### Search time
752
862
 
753
863
  Time spent performing the search.
754
864