pseek 3.4.1__tar.gz → 3.4.2__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.4.1
3
+ Version: 3.4.2
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -174,6 +174,26 @@ To search for a query that starts with `-`, use `--` to mark the end of options:
174
174
  psk -- --path
175
175
  ```
176
176
 
177
+ Of course the search query is optional. When no query is provided, Pseek displays the files and directories and file contents within the selected scope.
178
+
179
+ All other filters still apply, including `--glob`, `--depth`, `--size`, ignore rules, and other filtering options.
180
+
181
+ This makes Pseek useful as a flexible alternative to `ls` or `cat`, allowing you to inspect a filtered view of a directory tree and file contents.
182
+
183
+ ```bash
184
+ # List files and directories and file contents
185
+ psk
186
+
187
+ # List only Python files
188
+ psk --ext py
189
+
190
+ # List everything up to depth 2
191
+ psk --depth :2
192
+
193
+ # List everything except the build directory
194
+ psk --exclude build
195
+ ```
196
+
177
197
  ## Command Options
178
198
 
179
199
  | Option | Description |
@@ -146,6 +146,26 @@ To search for a query that starts with `-`, use `--` to mark the end of options:
146
146
  psk -- --path
147
147
  ```
148
148
 
149
+ Of course the search query is optional. When no query is provided, Pseek displays the files and directories and file contents within the selected scope.
150
+
151
+ All other filters still apply, including `--glob`, `--depth`, `--size`, ignore rules, and other filtering options.
152
+
153
+ This makes Pseek useful as a flexible alternative to `ls` or `cat`, allowing you to inspect a filtered view of a directory tree and file contents.
154
+
155
+ ```bash
156
+ # List files and directories and file contents
157
+ psk
158
+
159
+ # List only Python files
160
+ psk --ext py
161
+
162
+ # List everything up to depth 2
163
+ psk --depth :2
164
+
165
+ # List everything except the build directory
166
+ psk --exclude build
167
+ ```
168
+
149
169
  ## Command Options
150
170
 
151
171
  | Option | Description |
@@ -306,7 +306,7 @@ def check_rar_backend(archive_enabled: bool, tool_path: str, backend: str):
306
306
 
307
307
 
308
308
  @click.command()
309
- @click.argument('query')
309
+ @click.argument('query', required=False)
310
310
  @click.argument('path', type=click.Path(exists=True, file_okay=False, dir_okay=True),
311
311
  default='.', required=False)
312
312
  # Search type options
@@ -206,6 +206,9 @@ def parse_query_expression(config) -> ExprNode:
206
206
  If expr is False, treat the whole query as a single term.
207
207
  """
208
208
 
209
+ if config.query is None:
210
+ return None
211
+
209
212
  if not config.expr:
210
213
  return TermNode(
211
214
  config.query,
@@ -371,6 +374,9 @@ def evaluate_with_matches(
371
374
  def find_matches(expr: ExprNode, text: str, num: int = 0) -> list[tuple[int, int]]:
372
375
  """Find spans that contribute to a successful expression"""
373
376
 
377
+ if expr is None:
378
+ return []
379
+
374
380
  matched, matches = evaluate_with_matches(expr, text, num)
375
381
  # Remove duplicate ranges
376
382
  return list(dict.fromkeys(matches)) if matched else []
@@ -61,7 +61,7 @@ def search_file_and_dir(config, matches: dict, pattern, p: Path,
61
61
  None
62
62
  )
63
63
 
64
- if match_type and pattern.evaluate(p.name):
64
+ if match_type and (pattern is None or pattern.evaluate(p.name)):
65
65
  # Find matched query in the name
66
66
  name_matches = find_matches(
67
67
  pattern,
@@ -102,7 +102,7 @@ def search_file_and_dir(config, matches: dict, pattern, p: Path,
102
102
  None
103
103
  )
104
104
 
105
- if arc_match_type and pattern.evaluate(name.name):
105
+ if arc_match_type and (pattern is None or pattern.evaluate(name.name)):
106
106
  name_matches = find_matches(
107
107
  pattern,
108
108
  name.name,
@@ -231,7 +231,7 @@ def search_content(config, matches: dict, pattern, binary_pattern,
231
231
 
232
232
  collector = ContextCollector(config.context)
233
233
  for num, line in enumerate(decoded_content.splitlines(), 1):
234
- matched = pattern.evaluate(line)
234
+ matched = pattern is None or pattern.evaluate(line)
235
235
 
236
236
  if config.paths_only and matched:
237
237
  add_result(
@@ -285,7 +285,7 @@ def search_content(config, matches: dict, pattern, binary_pattern,
285
285
  # Skip lines that can't be decoded
286
286
  continue
287
287
 
288
- matched = pattern.evaluate(line_decoded)
288
+ matched = pattern is None or pattern.evaluate(line_decoded)
289
289
 
290
290
  # Avoid searching through the entire file content if the paths-only flag is True
291
291
  if config.paths_only and matched:
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "pseek"
7
- version = "3.4.1"
7
+ version = "3.4.2"
8
8
  description = "Pseek is a Python CLI toolkit to search files, folders, and text"
9
9
  readme = "README.md"
10
10
  license = "MIT"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes