rlmgrep 0.1.15__py3-none-any.whl → 0.1.17__py3-none-any.whl
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.
- rlmgrep/__init__.py +1 -1
- rlmgrep/cli.py +44 -0
- rlmgrep/ingest.py +17 -1
- {rlmgrep-0.1.15.dist-info → rlmgrep-0.1.17.dist-info}/METADATA +1 -1
- rlmgrep-0.1.17.dist-info/RECORD +14 -0
- rlmgrep-0.1.15.dist-info/RECORD +0 -14
- {rlmgrep-0.1.15.dist-info → rlmgrep-0.1.17.dist-info}/WHEEL +0 -0
- {rlmgrep-0.1.15.dist-info → rlmgrep-0.1.17.dist-info}/entry_points.txt +0 -0
- {rlmgrep-0.1.15.dist-info → rlmgrep-0.1.17.dist-info}/top_level.txt +0 -0
rlmgrep/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__all__ = ["__version__"]
|
|
2
|
-
__version__ = "0.1.
|
|
2
|
+
__version__ = "0.1.17"
|
rlmgrep/cli.py
CHANGED
|
@@ -3,6 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import os
|
|
5
5
|
import sys
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
6
8
|
from pathlib import Path
|
|
7
9
|
|
|
8
10
|
import dspy
|
|
@@ -172,6 +174,47 @@ def _find_git_root(start: Path) -> tuple[Path | None, Path | None]:
|
|
|
172
174
|
return None, None
|
|
173
175
|
|
|
174
176
|
|
|
177
|
+
def _global_ignore_paths(cwd: Path | None = None) -> list[Path]:
|
|
178
|
+
paths: list[Path] = []
|
|
179
|
+
cwd = cwd or Path.cwd()
|
|
180
|
+
if shutil.which("git"):
|
|
181
|
+
try:
|
|
182
|
+
result = subprocess.run(
|
|
183
|
+
["git", "config", "--get", "--path", "core.excludesfile"],
|
|
184
|
+
cwd=cwd,
|
|
185
|
+
capture_output=True,
|
|
186
|
+
text=True,
|
|
187
|
+
check=False,
|
|
188
|
+
)
|
|
189
|
+
value = (result.stdout or "").strip()
|
|
190
|
+
except Exception:
|
|
191
|
+
value = ""
|
|
192
|
+
if value:
|
|
193
|
+
candidate = Path(value).expanduser()
|
|
194
|
+
if candidate.exists():
|
|
195
|
+
paths.append(candidate)
|
|
196
|
+
|
|
197
|
+
xdg_config = os.getenv("XDG_CONFIG_HOME")
|
|
198
|
+
if xdg_config:
|
|
199
|
+
default_path = Path(xdg_config) / "git" / "ignore"
|
|
200
|
+
else:
|
|
201
|
+
default_path = Path.home() / ".config" / "git" / "ignore"
|
|
202
|
+
if default_path.exists():
|
|
203
|
+
paths.append(default_path)
|
|
204
|
+
|
|
205
|
+
legacy = Path.home() / ".gitignore_global"
|
|
206
|
+
if legacy.exists():
|
|
207
|
+
paths.append(legacy)
|
|
208
|
+
|
|
209
|
+
seen: set[Path] = set()
|
|
210
|
+
unique: list[Path] = []
|
|
211
|
+
for p in paths:
|
|
212
|
+
if p not in seen:
|
|
213
|
+
seen.add(p)
|
|
214
|
+
unique.append(p)
|
|
215
|
+
return unique
|
|
216
|
+
|
|
217
|
+
|
|
175
218
|
def _env_value(name: str) -> str | None:
|
|
176
219
|
val = os.getenv(name)
|
|
177
220
|
if val is None:
|
|
@@ -465,6 +508,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
465
508
|
extra_ignores: list[Path] = []
|
|
466
509
|
if git_dir is not None:
|
|
467
510
|
extra_ignores.append(git_dir / "info" / "exclude")
|
|
511
|
+
extra_ignores.extend(_global_ignore_paths(ignore_root))
|
|
468
512
|
ignore_spec = build_ignore_spec(ignore_root, extra_paths=extra_ignores)
|
|
469
513
|
|
|
470
514
|
candidates = collect_candidates(
|
rlmgrep/ingest.py
CHANGED
|
@@ -220,16 +220,32 @@ def build_ignore_spec(
|
|
|
220
220
|
escaped = True
|
|
221
221
|
if not escaped and line.startswith("#"):
|
|
222
222
|
continue
|
|
223
|
+
|
|
223
224
|
negated = False
|
|
224
225
|
if not escaped and line.startswith("!"):
|
|
225
226
|
negated = True
|
|
226
227
|
line = line[1:]
|
|
227
228
|
if not line:
|
|
228
229
|
continue
|
|
230
|
+
|
|
231
|
+
anchored = False
|
|
229
232
|
if line.startswith("/"):
|
|
233
|
+
anchored = True
|
|
230
234
|
line = line[1:]
|
|
235
|
+
if not line:
|
|
236
|
+
continue
|
|
237
|
+
|
|
231
238
|
if rel_dir:
|
|
232
|
-
|
|
239
|
+
if anchored:
|
|
240
|
+
line = f"{rel_dir}/{line}"
|
|
241
|
+
elif "/" in line:
|
|
242
|
+
line = f"{rel_dir}/{line}"
|
|
243
|
+
else:
|
|
244
|
+
line = f"{rel_dir}/**/{line}"
|
|
245
|
+
else:
|
|
246
|
+
if anchored:
|
|
247
|
+
line = f"/{line}"
|
|
248
|
+
|
|
233
249
|
if negated:
|
|
234
250
|
line = "!" + line
|
|
235
251
|
patterns.append(line)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
rlmgrep/__init__.py,sha256=6gcRw0B7EJ0ThTyw6kSsKCt6iL6AT76kGjvIBhZXwgE,49
|
|
2
|
+
rlmgrep/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
|
|
3
|
+
rlmgrep/cli.py,sha256=DbA8WDqkUrWYV5lItA_mlYB9v0H9ZOPm8JjZLIX1Y7E,23291
|
|
4
|
+
rlmgrep/config.py,sha256=u1iz-nI8dj-dZETbpIki3RQefHJEyi5oE5zE4_IR8kg,2399
|
|
5
|
+
rlmgrep/file_map.py,sha256=x2Ri1wzK8_87GUorsAV01K_nYLZcv30yIquDeTCcdEw,876
|
|
6
|
+
rlmgrep/ingest.py,sha256=AetMIjiZFD5Yz9W3QA1_Zu0bQqEcCU32-1kRy4fr1PE,12644
|
|
7
|
+
rlmgrep/interpreter.py,sha256=s_nMRxLlAU9C0JmUzUBW5NbVbuH67doVWF54K54STlA,2478
|
|
8
|
+
rlmgrep/render.py,sha256=mCTT6yuKNv7HJ46LzOyLkCbyBedCWSNd7UeubyLXcyM,3356
|
|
9
|
+
rlmgrep/rlm.py,sha256=i3rCTp8OABByF60Un5gO7265gaW4spwU0OFKIz4surg,5750
|
|
10
|
+
rlmgrep-0.1.17.dist-info/METADATA,sha256=2SR3PwE0915Bxuq4I1t8ZALU9o7bQG_LaqPCiXJV6fs,7969
|
|
11
|
+
rlmgrep-0.1.17.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
+
rlmgrep-0.1.17.dist-info/entry_points.txt,sha256=UV6QkEbkwBO1JJ53mm84_n35tVyOczPvOQ14ga7vrCI,45
|
|
13
|
+
rlmgrep-0.1.17.dist-info/top_level.txt,sha256=gTujSRsO58c80eN7aRH2cfe51FHxx8LJ1w1Y2YlHti0,8
|
|
14
|
+
rlmgrep-0.1.17.dist-info/RECORD,,
|
rlmgrep-0.1.15.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
rlmgrep/__init__.py,sha256=7lQKxph4q-63ntDsnV2TgQObrDVc7503eBKrCf_wsiE,49
|
|
2
|
-
rlmgrep/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
|
|
3
|
-
rlmgrep/cli.py,sha256=VZTfuMKXTafPtIYwzY93A_rOjUI-txLOCAZ7d5uVjdQ,22002
|
|
4
|
-
rlmgrep/config.py,sha256=u1iz-nI8dj-dZETbpIki3RQefHJEyi5oE5zE4_IR8kg,2399
|
|
5
|
-
rlmgrep/file_map.py,sha256=x2Ri1wzK8_87GUorsAV01K_nYLZcv30yIquDeTCcdEw,876
|
|
6
|
-
rlmgrep/ingest.py,sha256=zBdvTc5MxY8FqFKDPxhPs3U3v-bvTouCv8V5Yc4swK4,12258
|
|
7
|
-
rlmgrep/interpreter.py,sha256=s_nMRxLlAU9C0JmUzUBW5NbVbuH67doVWF54K54STlA,2478
|
|
8
|
-
rlmgrep/render.py,sha256=mCTT6yuKNv7HJ46LzOyLkCbyBedCWSNd7UeubyLXcyM,3356
|
|
9
|
-
rlmgrep/rlm.py,sha256=i3rCTp8OABByF60Un5gO7265gaW4spwU0OFKIz4surg,5750
|
|
10
|
-
rlmgrep-0.1.15.dist-info/METADATA,sha256=QqEYGSK4_z-dlWnCPcgibeqxURz-a0VSjeKO23XtuVo,7969
|
|
11
|
-
rlmgrep-0.1.15.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
-
rlmgrep-0.1.15.dist-info/entry_points.txt,sha256=UV6QkEbkwBO1JJ53mm84_n35tVyOczPvOQ14ga7vrCI,45
|
|
13
|
-
rlmgrep-0.1.15.dist-info/top_level.txt,sha256=gTujSRsO58c80eN7aRH2cfe51FHxx8LJ1w1Y2YlHti0,8
|
|
14
|
-
rlmgrep-0.1.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|