pseek 2.1.3__tar.gz → 2.1.5__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-2.1.3 → pseek-2.1.5}/PKG-INFO +18 -16
- pseek-2.1.5/README.md +80 -0
- {pseek-2.1.3 → pseek-2.1.5}/pseek/cli.py +8 -2
- {pseek-2.1.3 → pseek-2.1.5}/pseek/searcher.py +22 -11
- {pseek-2.1.3 → pseek-2.1.5}/pseek.egg-info/PKG-INFO +18 -16
- {pseek-2.1.3 → pseek-2.1.5}/setup.py +1 -1
- pseek-2.1.3/README.md +0 -79
- {pseek-2.1.3 → pseek-2.1.5}/LICENSE +0 -0
- {pseek-2.1.3 → pseek-2.1.5}/pseek/__init__.py +0 -0
- {pseek-2.1.3 → pseek-2.1.5}/pseek.egg-info/SOURCES.txt +0 -0
- {pseek-2.1.3 → pseek-2.1.5}/pseek.egg-info/dependency_links.txt +0 -0
- {pseek-2.1.3 → pseek-2.1.5}/pseek.egg-info/entry_points.txt +0 -0
- {pseek-2.1.3 → pseek-2.1.5}/pseek.egg-info/requires.txt +0 -0
- {pseek-2.1.3 → pseek-2.1.5}/pseek.egg-info/top_level.txt +0 -0
- {pseek-2.1.3 → pseek-2.1.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pseek
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.5
|
|
4
4
|
Summary: Pseek is a Python library to search files, folders, and text
|
|
5
5
|
Home-page: https://github.com/ArianN8610/pysearch
|
|
6
6
|
Author: Arian
|
|
@@ -18,6 +18,7 @@ Dynamic: classifier
|
|
|
18
18
|
Dynamic: description
|
|
19
19
|
Dynamic: description-content-type
|
|
20
20
|
Dynamic: home-page
|
|
21
|
+
Dynamic: license-file
|
|
21
22
|
Dynamic: requires-dist
|
|
22
23
|
Dynamic: requires-python
|
|
23
24
|
Dynamic: summary
|
|
@@ -87,17 +88,18 @@ pseek "error\d+" --regex
|
|
|
87
88
|
|
|
88
89
|
## Command Options
|
|
89
90
|
|
|
90
|
-
| Option
|
|
91
|
-
|
|
92
|
-
| `--path`
|
|
93
|
-
| `--file`
|
|
94
|
-
| `--directory`
|
|
95
|
-
| `--content`
|
|
96
|
-
| `--ext`, `--exclude-ext`
|
|
97
|
-
| `--case-sensitive`
|
|
98
|
-
| `--regex`
|
|
99
|
-
| `--include`, `--exclude`
|
|
100
|
-
| `--
|
|
101
|
-
| `--
|
|
102
|
-
| `--
|
|
103
|
-
| `--
|
|
91
|
+
| Option | Description |
|
|
92
|
+
|--------------------------------|------------------------------------------------------------------|
|
|
93
|
+
| `--path` | Base directory to search in (default: current directory `.`) |
|
|
94
|
+
| `--file` | Search only in file names |
|
|
95
|
+
| `--directory` | Search only in directory names |
|
|
96
|
+
| `--content` | Search inside file contents |
|
|
97
|
+
| `--ext`, `--exclude-ext` | Filter by file extension (e.g., `.txt`, `.log`) |
|
|
98
|
+
| `--case-sensitive` | Make the search case-sensitive |
|
|
99
|
+
| `--regex` | Use regular expression for searching |
|
|
100
|
+
| `--include`, `--exclude` | Limit search results to specific set of directories or files |
|
|
101
|
+
| `--re-include`, `--re-exclude` | Limit search results to specific directories or files with regex |
|
|
102
|
+
| `--word` | Match the whole word only |
|
|
103
|
+
| `--max-size`, `--min-size` | Specify maximum and minimum sizes for files and directories |
|
|
104
|
+
| `--full-path` | Display full path of files and directories |
|
|
105
|
+
| `--no-content` | Only display files path for content search |
|
pseek-2.1.5/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Pseek
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
A powerful command-line tool for searching files, directories, and content inside files efficiently. The tool supports searching by name, content, extensions, and more with advanced filtering options.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
* **Search in file & folder names**
|
|
10
|
+
* **Search inside file contents**
|
|
11
|
+
* **Highlight matches** in terminal output
|
|
12
|
+
* **Optimized for speed** with ThreadPoolExecutor
|
|
13
|
+
* **Cross-platform** (Linux, macOS, Windows)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### **1️⃣ Install via `pip` (Recommended)**
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pip install pseek
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### **2️⃣ Install from source**
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
git clone https://github.com/ArianN8610/pysearch.git
|
|
27
|
+
cd pseek
|
|
28
|
+
pip install click==8.1.8
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Run the command with a search query:
|
|
34
|
+
```sh
|
|
35
|
+
pseek <query> [options]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Search for a keyword in file & folder names
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pseek "my_keyword" --path /path/to/search --file --directory
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Search inside file contents
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
pseek "error" --path /var/logs --content
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Search only in specific file types
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pseek "TODO" --path ./projects --ext py --ext txt
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Search by regex
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pseek "error\d+" --regex
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Command Options
|
|
65
|
+
|
|
66
|
+
| Option | Description |
|
|
67
|
+
|--------------------------------|------------------------------------------------------------------|
|
|
68
|
+
| `--path` | Base directory to search in (default: current directory `.`) |
|
|
69
|
+
| `--file` | Search only in file names |
|
|
70
|
+
| `--directory` | Search only in directory names |
|
|
71
|
+
| `--content` | Search inside file contents |
|
|
72
|
+
| `--ext`, `--exclude-ext` | Filter by file extension (e.g., `.txt`, `.log`) |
|
|
73
|
+
| `--case-sensitive` | Make the search case-sensitive |
|
|
74
|
+
| `--regex` | Use regular expression for searching |
|
|
75
|
+
| `--include`, `--exclude` | Limit search results to specific set of directories or files |
|
|
76
|
+
| `--re-include`, `--re-exclude` | Limit search results to specific directories or files with regex |
|
|
77
|
+
| `--word` | Match the whole word only |
|
|
78
|
+
| `--max-size`, `--min-size` | Specify maximum and minimum sizes for files and directories |
|
|
79
|
+
| `--full-path` | Display full path of files and directories |
|
|
80
|
+
| `--no-content` | Only display files path for content search |
|
|
@@ -24,14 +24,18 @@ from .searcher import Search
|
|
|
24
24
|
multiple=True, help='Directories or files to include in search.')
|
|
25
25
|
@click.option('-e', '--exclude', type=click.Path(exists=True, file_okay=True, dir_okay=True),
|
|
26
26
|
multiple=True, help='Directories or files to exclude from search.')
|
|
27
|
+
@click.option('--re-include', type=click.STRING,
|
|
28
|
+
help='Directories or files to include in search with regex.')
|
|
29
|
+
@click.option('--re-exclude', type=click.STRING,
|
|
30
|
+
help='Directories or files to exclude from search with regex.')
|
|
27
31
|
# Size filters
|
|
28
32
|
@click.option('--max-size', type=click.FLOAT, help='Maximum file/directory size (in MB).')
|
|
29
33
|
@click.option('--min-size', type=click.FLOAT, help='Minimum file/directory size (in MB).')
|
|
30
34
|
# Output option
|
|
31
35
|
@click.option('--full-path', is_flag=True, help='Display full paths for results.')
|
|
32
36
|
@click.option('--no-content', is_flag=True, help='Only display files path for content search.')
|
|
33
|
-
def search(query, path, file, directory, content, case_sensitive, ext, exclude_ext, regex,
|
|
34
|
-
|
|
37
|
+
def search(query, path, file, directory, content, case_sensitive, ext, exclude_ext, regex, include, exclude,
|
|
38
|
+
re_include, re_exclude, word, max_size, min_size, full_path, no_content):
|
|
35
39
|
"""Search for files, directories, and file content based on the query."""
|
|
36
40
|
# If no search type is specified, search in all types.
|
|
37
41
|
if not any((file, directory, content)):
|
|
@@ -47,6 +51,8 @@ def search(query, path, file, directory, content, case_sensitive, ext, exclude_e
|
|
|
47
51
|
regex=regex,
|
|
48
52
|
include=include,
|
|
49
53
|
exclude=exclude,
|
|
54
|
+
re_include=re_include,
|
|
55
|
+
re_exclude=re_exclude,
|
|
50
56
|
whole_word=word,
|
|
51
57
|
max_size=max_size,
|
|
52
58
|
min_size=min_size,
|
|
@@ -19,9 +19,18 @@ EXCLUDED_EXTENSIONS = {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def compile_regex(txt, flags=0):
|
|
23
|
+
if txt is not None:
|
|
24
|
+
try:
|
|
25
|
+
return re.compile(txt, flags)
|
|
26
|
+
except re.error as e:
|
|
27
|
+
click.echo(click.style(f"Regex compile error: {e}", fg='red'))
|
|
28
|
+
sys.exit(1)
|
|
29
|
+
|
|
30
|
+
|
|
22
31
|
class Search:
|
|
23
|
-
def __init__(self, base_path, query, case_sensitive, ext, exclude_ext, regex, include, exclude,
|
|
24
|
-
max_size, min_size, full_path, no_content):
|
|
32
|
+
def __init__(self, base_path, query, case_sensitive, ext, exclude_ext, regex, include, exclude, re_include,
|
|
33
|
+
re_exclude, whole_word, max_size, min_size, full_path, no_content):
|
|
25
34
|
"""Initialize search parameters"""
|
|
26
35
|
self.base_path = Path(base_path)
|
|
27
36
|
self.query = query
|
|
@@ -29,8 +38,10 @@ class Search:
|
|
|
29
38
|
self.ext = set(ext)
|
|
30
39
|
self.exclude_ext = set(exclude_ext)
|
|
31
40
|
self.regex = regex
|
|
32
|
-
self.include = {Path(p)
|
|
33
|
-
self.exclude = {Path(p)
|
|
41
|
+
self.include = {Path(p) for p in include}
|
|
42
|
+
self.exclude = {Path(p) for p in exclude}
|
|
43
|
+
self.re_include = re_include
|
|
44
|
+
self.re_exclude = re_exclude
|
|
34
45
|
self.whole_word = whole_word
|
|
35
46
|
self.max_size = max_size
|
|
36
47
|
self.min_size = min_size
|
|
@@ -62,6 +73,12 @@ class Search:
|
|
|
62
73
|
or (search_type == 'directory' and not p_resolved.is_dir()):
|
|
63
74
|
return True
|
|
64
75
|
|
|
76
|
+
# Filter by regex include and exclude
|
|
77
|
+
if compiled_inc:=compile_regex(self.re_include):
|
|
78
|
+
return not compiled_inc.search(str(p_resolved))
|
|
79
|
+
if compiled_exc:=compile_regex(self.re_exclude):
|
|
80
|
+
return compiled_exc.search(str(p_resolved)) is not None
|
|
81
|
+
|
|
65
82
|
return False
|
|
66
83
|
|
|
67
84
|
def search(self, search_type: str):
|
|
@@ -77,13 +94,7 @@ class Search:
|
|
|
77
94
|
query = rf'\b{query}\b'
|
|
78
95
|
|
|
79
96
|
flags = 0 if self.case_sensitive else re.IGNORECASE # Adjust case sensitivity
|
|
80
|
-
|
|
81
|
-
# Precompile the regex pattern for performance
|
|
82
|
-
try:
|
|
83
|
-
pattern = re.compile(query, flags)
|
|
84
|
-
except re.error as e:
|
|
85
|
-
click.echo(click.style(f"Regex compile error: {e}", fg='red'))
|
|
86
|
-
sys.exit(1)
|
|
97
|
+
pattern = compile_regex(query, flags) # Precompile the regex pattern for performance
|
|
87
98
|
|
|
88
99
|
if search_type in ('file', 'directory'):
|
|
89
100
|
matches = []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pseek
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.5
|
|
4
4
|
Summary: Pseek is a Python library to search files, folders, and text
|
|
5
5
|
Home-page: https://github.com/ArianN8610/pysearch
|
|
6
6
|
Author: Arian
|
|
@@ -18,6 +18,7 @@ Dynamic: classifier
|
|
|
18
18
|
Dynamic: description
|
|
19
19
|
Dynamic: description-content-type
|
|
20
20
|
Dynamic: home-page
|
|
21
|
+
Dynamic: license-file
|
|
21
22
|
Dynamic: requires-dist
|
|
22
23
|
Dynamic: requires-python
|
|
23
24
|
Dynamic: summary
|
|
@@ -87,17 +88,18 @@ pseek "error\d+" --regex
|
|
|
87
88
|
|
|
88
89
|
## Command Options
|
|
89
90
|
|
|
90
|
-
| Option
|
|
91
|
-
|
|
92
|
-
| `--path`
|
|
93
|
-
| `--file`
|
|
94
|
-
| `--directory`
|
|
95
|
-
| `--content`
|
|
96
|
-
| `--ext`, `--exclude-ext`
|
|
97
|
-
| `--case-sensitive`
|
|
98
|
-
| `--regex`
|
|
99
|
-
| `--include`, `--exclude`
|
|
100
|
-
| `--
|
|
101
|
-
| `--
|
|
102
|
-
| `--
|
|
103
|
-
| `--
|
|
91
|
+
| Option | Description |
|
|
92
|
+
|--------------------------------|------------------------------------------------------------------|
|
|
93
|
+
| `--path` | Base directory to search in (default: current directory `.`) |
|
|
94
|
+
| `--file` | Search only in file names |
|
|
95
|
+
| `--directory` | Search only in directory names |
|
|
96
|
+
| `--content` | Search inside file contents |
|
|
97
|
+
| `--ext`, `--exclude-ext` | Filter by file extension (e.g., `.txt`, `.log`) |
|
|
98
|
+
| `--case-sensitive` | Make the search case-sensitive |
|
|
99
|
+
| `--regex` | Use regular expression for searching |
|
|
100
|
+
| `--include`, `--exclude` | Limit search results to specific set of directories or files |
|
|
101
|
+
| `--re-include`, `--re-exclude` | Limit search results to specific directories or files with regex |
|
|
102
|
+
| `--word` | Match the whole word only |
|
|
103
|
+
| `--max-size`, `--min-size` | Specify maximum and minimum sizes for files and directories |
|
|
104
|
+
| `--full-path` | Display full path of files and directories |
|
|
105
|
+
| `--no-content` | Only display files path for content search |
|
pseek-2.1.3/README.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# Pseek
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
A powerful command-line tool for searching files, directories, and content inside files efficiently. The tool supports searching by name, content, extensions, and more with advanced filtering options.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
* **Search in file & folder names**
|
|
10
|
-
* **Search inside file contents**
|
|
11
|
-
* **Highlight matches** in terminal output
|
|
12
|
-
* **Optimized for speed** with ThreadPoolExecutor
|
|
13
|
-
* **Cross-platform** (Linux, macOS, Windows)
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
### **1️⃣ Install via `pip` (Recommended)**
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
pip install pseek
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### **2️⃣ Install from source**
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
git clone https://github.com/ArianN8610/pysearch.git
|
|
27
|
-
cd pseek
|
|
28
|
-
pip install click==8.1.8
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
Run the command with a search query:
|
|
34
|
-
```sh
|
|
35
|
-
pseek <query> [options]
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Examples
|
|
39
|
-
|
|
40
|
-
### Search for a keyword in file & folder names
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
pseek "my_keyword" --path /path/to/search --file --directory
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Search inside file contents
|
|
47
|
-
|
|
48
|
-
```sh
|
|
49
|
-
pseek "error" --path /var/logs --content
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Search only in specific file types
|
|
53
|
-
|
|
54
|
-
```sh
|
|
55
|
-
pseek "TODO" --path ./projects --ext py --ext txt
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Search by regex
|
|
59
|
-
|
|
60
|
-
```sh
|
|
61
|
-
pseek "error\d+" --regex
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Command Options
|
|
65
|
-
|
|
66
|
-
| Option | Description |
|
|
67
|
-
|----------------------------|--------------------------------------------------------------|
|
|
68
|
-
| `--path` | Base directory to search in (default: current directory `.`) |
|
|
69
|
-
| `--file` | Search only in file names |
|
|
70
|
-
| `--directory` | Search only in directory names |
|
|
71
|
-
| `--content` | Search inside file contents |
|
|
72
|
-
| `--ext`, `--exclude-ext` | Filter by file extension (e.g., `.txt`, `.log`) |
|
|
73
|
-
| `--case-sensitive` | Make the search case-sensitive |
|
|
74
|
-
| `--regex` | Use regular expression for searching |
|
|
75
|
-
| `--include`, `--exclude` | Limit search results to specific set of directories or files |
|
|
76
|
-
| `--word` | Match the whole word only |
|
|
77
|
-
| `--max-size`, `--min-size` | Specify maximum and minimum sizes for files and directories |
|
|
78
|
-
| `--full-path` | Display full path of files and directories |
|
|
79
|
-
| `--no-content` | Only display files path for content search |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|