rlmgrep 0.1.24__py3-none-any.whl → 0.1.26__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 +70 -26
- {rlmgrep-0.1.24.dist-info → rlmgrep-0.1.26.dist-info}/METADATA +1 -1
- {rlmgrep-0.1.24.dist-info → rlmgrep-0.1.26.dist-info}/RECORD +7 -7
- {rlmgrep-0.1.24.dist-info → rlmgrep-0.1.26.dist-info}/WHEEL +0 -0
- {rlmgrep-0.1.24.dist-info → rlmgrep-0.1.26.dist-info}/entry_points.txt +0 -0
- {rlmgrep-0.1.24.dist-info → rlmgrep-0.1.26.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.26"
|
rlmgrep/cli.py
CHANGED
|
@@ -36,7 +36,7 @@ from .render import render_matches
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def _warn(msg: str) -> None:
|
|
39
|
-
print(f"rlmgrep: {msg}", file=sys.stderr)
|
|
39
|
+
print(f"rlmgrep: {msg}", file=sys.stderr, flush=True)
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def _console() -> Console:
|
|
@@ -538,7 +538,6 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
538
538
|
_warn(w)
|
|
539
539
|
|
|
540
540
|
console = _console()
|
|
541
|
-
progress = None
|
|
542
541
|
|
|
543
542
|
# Resolve input corpus.
|
|
544
543
|
globs = _split_list(args.globs)
|
|
@@ -602,26 +601,31 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
602
601
|
ignore_spec = build_ignore_spec(ignore_root, extra_paths=extra_ignores)
|
|
603
602
|
|
|
604
603
|
scan_task = None
|
|
605
|
-
load_task = None
|
|
606
604
|
scan_count = 0
|
|
605
|
+
scan_progress = None
|
|
607
606
|
if sys.stderr.isatty():
|
|
608
|
-
|
|
607
|
+
scan_progress = Progress(
|
|
609
608
|
SpinnerColumn(),
|
|
610
609
|
TextColumn("{task.description}"),
|
|
610
|
+
TextColumn("{task.completed} files"),
|
|
611
611
|
BarColumn(),
|
|
612
612
|
TaskProgressColumn(),
|
|
613
613
|
TimeElapsedColumn(),
|
|
614
614
|
console=console,
|
|
615
615
|
transient=False,
|
|
616
616
|
)
|
|
617
|
-
|
|
618
|
-
scan_task =
|
|
617
|
+
scan_progress.start()
|
|
618
|
+
scan_task = scan_progress.add_task("Scanning files", total=None)
|
|
619
619
|
|
|
620
620
|
def _scan_update(count: int) -> None:
|
|
621
621
|
nonlocal scan_count
|
|
622
622
|
scan_count = count
|
|
623
|
-
if
|
|
624
|
-
|
|
623
|
+
if scan_progress is not None and scan_task is not None:
|
|
624
|
+
scan_progress.update(
|
|
625
|
+
scan_task,
|
|
626
|
+
completed=count,
|
|
627
|
+
description=f"Scanning files ({count})",
|
|
628
|
+
)
|
|
625
629
|
|
|
626
630
|
candidates, scanned = collect_candidates(
|
|
627
631
|
input_paths,
|
|
@@ -632,21 +636,21 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
632
636
|
include_hidden=args.hidden,
|
|
633
637
|
ignore_spec=ignore_spec,
|
|
634
638
|
ignore_root=ignore_root,
|
|
635
|
-
scan_progress=_scan_update if
|
|
639
|
+
scan_progress=_scan_update if scan_progress is not None else None,
|
|
636
640
|
)
|
|
637
|
-
if
|
|
638
|
-
|
|
641
|
+
if scan_progress is not None and scan_task is not None:
|
|
642
|
+
scan_progress.update(
|
|
639
643
|
scan_task,
|
|
640
644
|
total=scanned or scan_count,
|
|
641
645
|
completed=scanned or scan_count,
|
|
646
|
+
description=f"Scanning files ({scanned or scan_count})",
|
|
642
647
|
)
|
|
648
|
+
scan_progress.stop()
|
|
643
649
|
candidate_count = len(candidates)
|
|
644
650
|
if hard_max is not None and candidate_count > hard_max:
|
|
645
651
|
_warn(
|
|
646
652
|
f"{candidate_count} files to load (over {hard_max}); aborting"
|
|
647
653
|
)
|
|
648
|
-
if progress is not None:
|
|
649
|
-
progress.stop()
|
|
650
654
|
return 2
|
|
651
655
|
if (
|
|
652
656
|
warn_threshold is not None
|
|
@@ -654,19 +658,40 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
654
658
|
and not args.yes
|
|
655
659
|
):
|
|
656
660
|
if not _confirm_over_limit(candidate_count, warn_threshold):
|
|
657
|
-
if progress is not None:
|
|
658
|
-
progress.stop()
|
|
659
661
|
return 2
|
|
660
|
-
|
|
661
|
-
|
|
662
|
+
|
|
663
|
+
load_task = None
|
|
664
|
+
load_progress = None
|
|
665
|
+
if sys.stderr.isatty():
|
|
666
|
+
load_progress = Progress(
|
|
667
|
+
SpinnerColumn(),
|
|
668
|
+
TextColumn("{task.description}"),
|
|
669
|
+
TextColumn("{task.completed}/{task.total} files"),
|
|
670
|
+
BarColumn(),
|
|
671
|
+
TaskProgressColumn(),
|
|
672
|
+
TimeElapsedColumn(),
|
|
673
|
+
console=console,
|
|
674
|
+
transient=False,
|
|
675
|
+
)
|
|
676
|
+
load_progress.start()
|
|
677
|
+
load_task = load_progress.add_task(
|
|
662
678
|
"Loading files",
|
|
663
679
|
total=candidate_count,
|
|
664
680
|
completed=0,
|
|
665
681
|
)
|
|
666
682
|
|
|
683
|
+
load_done = 0
|
|
684
|
+
|
|
667
685
|
def _load_update(done: int, total: int) -> None:
|
|
668
|
-
|
|
669
|
-
|
|
686
|
+
nonlocal load_done
|
|
687
|
+
load_done = done
|
|
688
|
+
if load_progress is not None and load_task is not None:
|
|
689
|
+
load_progress.update(
|
|
690
|
+
load_task,
|
|
691
|
+
completed=done,
|
|
692
|
+
total=total,
|
|
693
|
+
description=f"Loading files ({done}/{total})",
|
|
694
|
+
)
|
|
670
695
|
|
|
671
696
|
files, warnings = load_files(
|
|
672
697
|
candidates,
|
|
@@ -676,10 +701,24 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
676
701
|
enable_audio=md_enable_audio,
|
|
677
702
|
audio_transcriber=audio_transcriber,
|
|
678
703
|
binary_as_text=args.binary_as_text,
|
|
679
|
-
progress=_load_update if
|
|
704
|
+
progress=_load_update if load_progress is not None else None,
|
|
680
705
|
)
|
|
681
|
-
if
|
|
682
|
-
|
|
706
|
+
if load_progress is not None and load_task is not None:
|
|
707
|
+
load_progress.update(
|
|
708
|
+
load_task,
|
|
709
|
+
completed=load_done,
|
|
710
|
+
total=candidate_count,
|
|
711
|
+
description=f"Loading files ({load_done}/{candidate_count})",
|
|
712
|
+
)
|
|
713
|
+
load_progress.stop()
|
|
714
|
+
|
|
715
|
+
scanned_total = scanned or scan_count
|
|
716
|
+
loaded_total = len(files)
|
|
717
|
+
skipped_total = max(0, candidate_count - loaded_total)
|
|
718
|
+
summary = f"Scanned {scanned_total} files. Loaded {loaded_total}."
|
|
719
|
+
if skipped_total:
|
|
720
|
+
summary += f" Skipped {skipped_total}."
|
|
721
|
+
_warn(summary)
|
|
683
722
|
|
|
684
723
|
for w in warnings:
|
|
685
724
|
_warn(w)
|
|
@@ -792,7 +831,9 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
792
831
|
before = args.before if args.before is not None else args.context
|
|
793
832
|
after = args.after if args.after is not None else args.context
|
|
794
833
|
|
|
795
|
-
|
|
834
|
+
stdout_tty = sys.stdout.isatty()
|
|
835
|
+
stderr_tty = sys.stderr.isatty()
|
|
836
|
+
use_color = stdout_tty and not os.getenv("NO_COLOR")
|
|
796
837
|
|
|
797
838
|
output_lines = render_matches(
|
|
798
839
|
files=files,
|
|
@@ -803,13 +844,16 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
803
844
|
heading=True,
|
|
804
845
|
)
|
|
805
846
|
|
|
806
|
-
stdout_console = Console(force_terminal=
|
|
847
|
+
stdout_console = Console(force_terminal=stdout_tty, color_system="auto")
|
|
807
848
|
if args.answer and answer:
|
|
808
849
|
_print_answer(console, answer)
|
|
809
850
|
|
|
810
|
-
if
|
|
851
|
+
if stdout_tty:
|
|
811
852
|
_print_matches(stdout_console, output_lines, use_color=use_color)
|
|
812
|
-
|
|
853
|
+
elif stderr_tty:
|
|
854
|
+
_print_matches(console, output_lines, use_color=False)
|
|
855
|
+
|
|
856
|
+
if not stdout_tty:
|
|
813
857
|
for line in output_lines:
|
|
814
858
|
print(line)
|
|
815
859
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
rlmgrep/__init__.py,sha256=
|
|
1
|
+
rlmgrep/__init__.py,sha256=JyNu1JArYKRlsONizRn4WtReW7YQ64wHx46ZFucbFRg,49
|
|
2
2
|
rlmgrep/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
|
|
3
|
-
rlmgrep/cli.py,sha256=
|
|
3
|
+
rlmgrep/cli.py,sha256=Sy-ZAZqeppXzWcbhDKMV7GOL1EFErNkoc6uv7gmVlW4,29373
|
|
4
4
|
rlmgrep/config.py,sha256=u1iz-nI8dj-dZETbpIki3RQefHJEyi5oE5zE4_IR8kg,2399
|
|
5
5
|
rlmgrep/file_map.py,sha256=x2Ri1wzK8_87GUorsAV01K_nYLZcv30yIquDeTCcdEw,876
|
|
6
6
|
rlmgrep/ingest.py,sha256=906JUwWRC0XDoYRXs4-XdV3fay8mQc324l0suQLyS-k,13738
|
|
7
7
|
rlmgrep/interpreter.py,sha256=s_nMRxLlAU9C0JmUzUBW5NbVbuH67doVWF54K54STlA,2478
|
|
8
8
|
rlmgrep/render.py,sha256=mCTT6yuKNv7HJ46LzOyLkCbyBedCWSNd7UeubyLXcyM,3356
|
|
9
9
|
rlmgrep/rlm.py,sha256=i3rCTp8OABByF60Un5gO7265gaW4spwU0OFKIz4surg,5750
|
|
10
|
-
rlmgrep-0.1.
|
|
11
|
-
rlmgrep-0.1.
|
|
12
|
-
rlmgrep-0.1.
|
|
13
|
-
rlmgrep-0.1.
|
|
14
|
-
rlmgrep-0.1.
|
|
10
|
+
rlmgrep-0.1.26.dist-info/METADATA,sha256=D1CU5EWI9qoLsch3Nak-wUeKMuf3htk430tbhAOOJ5g,8011
|
|
11
|
+
rlmgrep-0.1.26.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
+
rlmgrep-0.1.26.dist-info/entry_points.txt,sha256=UV6QkEbkwBO1JJ53mm84_n35tVyOczPvOQ14ga7vrCI,45
|
|
13
|
+
rlmgrep-0.1.26.dist-info/top_level.txt,sha256=gTujSRsO58c80eN7aRH2cfe51FHxx8LJ1w1Y2YlHti0,8
|
|
14
|
+
rlmgrep-0.1.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|